Переглянути джерело

refac: including posts2posts for convenience

tags/0.9.0
J 6 роки тому
джерело
коміт
1a941fe7b7
100 змінених файлів з 8446 додано та 0 видалено
  1. 41
    0
      plugins/posts-to-posts/CONTRIBUTING.md
  2. 153
    0
      plugins/posts-to-posts/admin/box-factory.php
  3. 228
    0
      plugins/posts-to-posts/admin/box.css
  4. 473
    0
      plugins/posts-to-posts/admin/box.js
  5. 326
    0
      plugins/posts-to-posts/admin/box.php
  6. 24
    0
      plugins/posts-to-posts/admin/column-factory.php
  7. 36
    0
      plugins/posts-to-posts/admin/column-post.php
  8. 48
    0
      plugins/posts-to-posts/admin/column-user.php
  9. 77
    0
      plugins/posts-to-posts/admin/column.php
  10. 19
    0
      plugins/posts-to-posts/admin/dropdown-factory.php
  11. 17
    0
      plugins/posts-to-posts/admin/dropdown-post.php
  12. 37
    0
      plugins/posts-to-posts/admin/dropdown-user.php
  13. 73
    0
      plugins/posts-to-posts/admin/dropdown.php
  14. 103
    0
      plugins/posts-to-posts/admin/factory.php
  15. 23
    0
      plugins/posts-to-posts/admin/field-delete.php
  16. 27
    0
      plugins/posts-to-posts/admin/field-generic.php
  17. 23
    0
      plugins/posts-to-posts/admin/field-order.php
  18. 13
    0
      plugins/posts-to-posts/admin/field-title-attachment.php
  19. 22
    0
      plugins/posts-to-posts/admin/field-title-post.php
  20. 11
    0
      plugins/posts-to-posts/admin/field-title-user.php
  21. 26
    0
      plugins/posts-to-posts/admin/field-title.php
  22. 10
    0
      plugins/posts-to-posts/admin/field.php
  23. BIN
      plugins/posts-to-posts/admin/images/minus.png
  24. BIN
      plugins/posts-to-posts/admin/images/plus.png
  25. BIN
      plugins/posts-to-posts/admin/images/sort.png
  26. 610
    0
      plugins/posts-to-posts/admin/mustache.js
  27. 24
    0
      plugins/posts-to-posts/admin/mustache.php
  28. 43
    0
      plugins/posts-to-posts/admin/templates/box.html
  29. 4
    0
      plugins/posts-to-posts/admin/templates/column-create.html
  30. 1
    0
      plugins/posts-to-posts/admin/templates/column-delete-all.html
  31. 2
    0
      plugins/posts-to-posts/admin/templates/column-delete.html
  32. 1
    0
      plugins/posts-to-posts/admin/templates/column-title.html
  33. 8
    0
      plugins/posts-to-posts/admin/templates/connection-types-form.html
  34. 24
    0
      plugins/posts-to-posts/admin/templates/connection-types.html
  35. 2
    0
      plugins/posts-to-posts/admin/templates/tab-create-post.html
  36. 19
    0
      plugins/posts-to-posts/admin/templates/tab-list.html
  37. 5
    0
      plugins/posts-to-posts/admin/templates/tab-search.html
  38. 5
    0
      plugins/posts-to-posts/admin/templates/table-row.html
  39. 135
    0
      plugins/posts-to-posts/admin/tools-page.php
  40. 15
    0
      plugins/posts-to-posts/admin/tools.css
  41. 109
    0
      plugins/posts-to-posts/command.php
  42. 18
    0
      plugins/posts-to-posts/composer.json
  43. 40
    0
      plugins/posts-to-posts/debug-utils.php
  44. BIN
      plugins/posts-to-posts/lang/posts-to-posts-da_DK.mo
  45. 156
    0
      plugins/posts-to-posts/lang/posts-to-posts-da_DK.po
  46. BIN
      plugins/posts-to-posts/lang/posts-to-posts-de_DE.mo
  47. 192
    0
      plugins/posts-to-posts/lang/posts-to-posts-de_DE.po
  48. BIN
      plugins/posts-to-posts/lang/posts-to-posts-es_ES.mo
  49. 153
    0
      plugins/posts-to-posts/lang/posts-to-posts-es_ES.po
  50. BIN
      plugins/posts-to-posts/lang/posts-to-posts-et_EE.mo
  51. 233
    0
      plugins/posts-to-posts/lang/posts-to-posts-et_EE.po
  52. BIN
      plugins/posts-to-posts/lang/posts-to-posts-fa_IR.mo
  53. 142
    0
      plugins/posts-to-posts/lang/posts-to-posts-fa_IR.po
  54. BIN
      plugins/posts-to-posts/lang/posts-to-posts-fi.mo
  55. 156
    0
      plugins/posts-to-posts/lang/posts-to-posts-fi.po
  56. BIN
      plugins/posts-to-posts/lang/posts-to-posts-fr_FR.mo
  57. 180
    0
      plugins/posts-to-posts/lang/posts-to-posts-fr_FR.po
  58. BIN
      plugins/posts-to-posts/lang/posts-to-posts-hr.mo
  59. 73
    0
      plugins/posts-to-posts/lang/posts-to-posts-hr.po
  60. BIN
      plugins/posts-to-posts/lang/posts-to-posts-it_IT.mo
  61. 133
    0
      plugins/posts-to-posts/lang/posts-to-posts-it_IT.po
  62. BIN
      plugins/posts-to-posts/lang/posts-to-posts-ja.mo
  63. 155
    0
      plugins/posts-to-posts/lang/posts-to-posts-ja.po
  64. BIN
      plugins/posts-to-posts/lang/posts-to-posts-nl_NL.mo
  65. 155
    0
      plugins/posts-to-posts/lang/posts-to-posts-nl_NL.po
  66. BIN
      plugins/posts-to-posts/lang/posts-to-posts-pt_BR.mo
  67. 74
    0
      plugins/posts-to-posts/lang/posts-to-posts-pt_BR.po
  68. BIN
      plugins/posts-to-posts/lang/posts-to-posts-ro_RO.mo
  69. 198
    0
      plugins/posts-to-posts/lang/posts-to-posts-ro_RO.po
  70. BIN
      plugins/posts-to-posts/lang/posts-to-posts-ru_RU.mo
  71. 88
    0
      plugins/posts-to-posts/lang/posts-to-posts-ru_RU.po
  72. BIN
      plugins/posts-to-posts/lang/posts-to-posts-sr_RS.mo
  73. 190
    0
      plugins/posts-to-posts/lang/posts-to-posts-sr_RS.po
  74. BIN
      plugins/posts-to-posts/lang/posts-to-posts-sv_SE.mo
  75. 165
    0
      plugins/posts-to-posts/lang/posts-to-posts-sv_SE.po
  76. BIN
      plugins/posts-to-posts/lang/posts-to-posts-tr_TR.mo
  77. 114
    0
      plugins/posts-to-posts/lang/posts-to-posts-tr_TR.po
  78. BIN
      plugins/posts-to-posts/lang/posts-to-posts-zh_CN.mo
  79. 155
    0
      plugins/posts-to-posts/lang/posts-to-posts-zh_CN.po
  80. 153
    0
      plugins/posts-to-posts/lang/posts-to-posts.pot
  81. 70
    0
      plugins/posts-to-posts/posts-to-posts.php
  82. 309
    0
      plugins/posts-to-posts/readme.txt
  83. 26
    0
      plugins/posts-to-posts/vendor/mustache/mustache/.php_cs
  84. 13
    0
      plugins/posts-to-posts/vendor/mustache/mustache/.styleci.yml
  85. 19
    0
      plugins/posts-to-posts/vendor/mustache/mustache/.travis.yml
  86. 35
    0
      plugins/posts-to-posts/vendor/mustache/mustache/CONTRIBUTING.md
  87. 21
    0
      plugins/posts-to-posts/vendor/mustache/mustache/LICENSE
  88. 71
    0
      plugins/posts-to-posts/vendor/mustache/mustache/README.md
  89. 25
    0
      plugins/posts-to-posts/vendor/mustache/mustache/composer.json
  90. 17
    0
      plugins/posts-to-posts/vendor/mustache/mustache/phpunit.xml.dist
  91. 74
    0
      plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Autoloader.php
  92. 36
    0
      plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Cache.php
  93. 60
    0
      plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Cache/AbstractCache.php
  94. 155
    0
      plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Cache/FilesystemCache.php
  95. 47
    0
      plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Cache/NoopCache.php
  96. 681
    0
      plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Compiler.php
  97. 242
    0
      plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Context.php
  98. 787
    0
      plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Engine.php
  99. 18
    0
      plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Exception.php
  100. 0
    0
      plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Exception/InvalidArgumentException.php

+ 41
- 0
plugins/posts-to-posts/CONTRIBUTING.md Переглянути файл

@@ -0,0 +1,41 @@
1
+This guide is meant for developers wanting to work on the plugin code.
2
+
3
+### Setup
4
+
5
+Step 1: Make a fork and clone it:
6
+
7
+```
8
+git clone git@github.com:{YOUR GITHUB USERNAME}/wp-posts-to-posts.git posts-to-posts
9
+```
10
+
11
+Step 2: Install the dependencies via [Composer](https://getcomposer.org):
12
+
13
+```bash
14
+php composer.phar install
15
+```
16
+
17
+You can now work on the PHP and CSS files. Please follow the [WordPress Coding Standards](http://make.wordpress.org/core/handbook/coding-standards/).
18
+
19
+Step 3: Open a pull request.
20
+
21
+**Note:** This repository only contains the admin UI; the core functionality is in [lib-posts-to-posts](https://github.com/scribu/wp-lib-posts-to-posts).
22
+
23
+### Unit Tests
24
+
25
+If you want to add a new feature, please consider adding a new test for it as well.
26
+
27
+The following instructions assume a UNIX-like environment (OS X, Linux, etc.).
28
+
29
+Step 1: Install and configure the official WordPress testing suite:
30
+
31
+```bash
32
+./bin/install-wp-tests
33
+```
34
+
35
+Note that all data in the test DB will be _deleted_ once you run the tests.
36
+
37
+Step 2: Run the tests:
38
+
39
+```bash
40
+phpunit
41
+```

+ 153
- 0
plugins/posts-to-posts/admin/box-factory.php Переглянути файл

@@ -0,0 +1,153 @@
1
+<?php
2
+
3
+define( 'P2P_BOX_NONCE', 'p2p-box' );
4
+
5
+class P2P_Box_Factory extends P2P_Factory {
6
+
7
+	protected $key = 'admin_box';
8
+
9
+	function __construct() {
10
+		parent::__construct();
11
+
12
+		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
13
+		add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
14
+		add_action( 'wp_ajax_p2p_box', array( $this, 'wp_ajax_p2p_box' ) );
15
+	}
16
+
17
+	function expand_arg( $args ) {
18
+		$box_args = parent::expand_arg( $args );
19
+
20
+		foreach ( array( 'can_create_post' ) as $key ) {
21
+			if ( isset( $args[ $key ] ) ) {
22
+				$box_args[ $key ] = _p2p_pluck( $args, $key );
23
+			}
24
+		}
25
+
26
+		$box_args = wp_parse_args( $box_args, array(
27
+			'context' => 'side',
28
+			'priority' => 'default',
29
+			'can_create_post' => true
30
+		) );
31
+
32
+		return $box_args;
33
+	}
34
+
35
+	function add_meta_boxes( $post_type ) {
36
+		$this->filter( 'post', $post_type );
37
+	}
38
+
39
+	function add_item( $directed, $object_type, $post_type, $title ) {
40
+		if ( !self::show_box( $directed, $GLOBALS['post'] ) )
41
+			return;
42
+
43
+		$box = $this->create_box( $directed );
44
+		$box_args = $this->queue[ $directed->name ];
45
+
46
+		add_meta_box(
47
+			sprintf( 'p2p-%s-%s', $directed->get_direction(), $directed->name ),
48
+			$title,
49
+			array( $box, 'render' ),
50
+			$post_type,
51
+			$box_args->context,
52
+			$box_args->priority
53
+		);
54
+
55
+		$box->init_scripts();
56
+	}
57
+
58
+	private static function show_box( $directed, $post ) {
59
+		$show = $directed->get( 'opposite', 'side' )->can_edit_connections();
60
+
61
+		return apply_filters( 'p2p_admin_box_show', $show, $directed, $post );
62
+	}
63
+
64
+	private function create_box( $directed ) {
65
+		$box_args = $this->queue[ $directed->name ];
66
+
67
+		$title_class = str_replace( 'P2P_Side_', 'P2P_Field_Title_',
68
+			get_class( $directed->get( 'opposite', 'side' ) ) );
69
+
70
+		$columns = array(
71
+			'delete' => new P2P_Field_Delete,
72
+			'title' => new $title_class( $directed->get( 'opposite', 'labels' )->singular_name ),
73
+		);
74
+
75
+		foreach ( $directed->fields as $key => $data ) {
76
+			$columns[ 'meta-' . $key ] = new P2P_Field_Generic( $key, $data );
77
+		}
78
+
79
+		if ( $orderby_key = $directed->get_orderby_key() ) {
80
+			$columns['order'] = new P2P_Field_Order( $orderby_key );
81
+		}
82
+
83
+		return new P2P_Box( $box_args, $columns, $directed );
84
+	}
85
+
86
+	/**
87
+	 * Collect metadata from all boxes.
88
+	 */
89
+	function save_post( $post_id, $post ) {
90
+		if ( 'revision' == $post->post_type || defined( 'DOING_AJAX' ) )
91
+			return;
92
+
93
+		if ( isset( $_POST['p2p_connections'] ) ) {
94
+			// Loop through the hidden fields instead of through $_POST['p2p_meta'] because empty checkboxes send no data.
95
+			foreach ( $_POST['p2p_connections'] as $p2p_id ) {
96
+				$data = scbForms::get_value( array( 'p2p_meta', $p2p_id ), $_POST, array() );
97
+
98
+				$connection = p2p_get_connection( $p2p_id );
99
+
100
+				if ( ! $connection )
101
+					continue;
102
+
103
+				$fields = p2p_type( $connection->p2p_type )->fields;
104
+
105
+				foreach ( $fields as $key => &$field ) {
106
+					$field['name'] = $key;
107
+				}
108
+
109
+				$data = scbForms::validate_post_data( $fields, $data );
110
+
111
+				scbForms::update_meta( $fields, $data, $p2p_id, 'p2p' );
112
+			}
113
+		}
114
+
115
+		// Ordering
116
+		if ( isset( $_POST['p2p_order'] ) ) {
117
+			foreach ( $_POST['p2p_order'] as $key => $list ) {
118
+				foreach ( $list as $i => $p2p_id ) {
119
+					p2p_update_meta( $p2p_id, $key, $i );
120
+				}
121
+			}
122
+		}
123
+	}
124
+
125
+	/**
126
+	 * Controller for all box ajax requests.
127
+	 */
128
+	function wp_ajax_p2p_box() {
129
+		check_ajax_referer( P2P_BOX_NONCE, 'nonce' );
130
+
131
+		$ctype = p2p_type( $_REQUEST['p2p_type'] );
132
+		if ( !$ctype || !isset( $this->queue[$ctype->name] ) )
133
+			die(0);
134
+
135
+		$directed = $ctype->set_direction( $_REQUEST['direction'] );
136
+		if ( !$directed )
137
+			die(0);
138
+
139
+		$post = get_post( $_REQUEST['from'] );
140
+		if ( !$post )
141
+			die(0);
142
+
143
+		if ( !self::show_box( $directed, $post ) )
144
+			die(-1);
145
+
146
+		$box = $this->create_box( $directed );
147
+
148
+		$method = 'ajax_' . $_REQUEST['subaction'];
149
+
150
+		$box->$method();
151
+	}
152
+}
153
+

+ 228
- 0
plugins/posts-to-posts/admin/box.css Переглянути файл

@@ -0,0 +1,228 @@
1
+.p2p-placeholder {
2
+	color: #AAA;
3
+}
4
+
5
+.p2p-box td a {
6
+	text-decoration: none;
7
+}
8
+
9
+.p2p-toggle-tabs {
10
+	font-weight: bold;
11
+}
12
+
13
+/* Tabs */
14
+
15
+.p2p-box .tabs-panel {
16
+	border: 1px solid #DFDFDF;
17
+	display: none;
18
+	padding: 10px;
19
+}
20
+
21
+.p2p-box p.help {
22
+	color: #666;
23
+	font-style: normal;
24
+}
25
+
26
+.p2p-box .p2p-tab-search {
27
+	display: block;
28
+}
29
+
30
+.tabs-panel {
31
+	border-radius: 0 3px 3px 3px;
32
+}
33
+
34
+/* Connections */
35
+
36
+.p2p-results,
37
+.p2p-connections {
38
+	background-color: #F9F9F9;
39
+	border-color: #DFDFDF;
40
+	border-radius: 3px;
41
+	border-spacing: 0;
42
+	border-style: solid;
43
+	border-width: 1px;
44
+	width: 100%;
45
+}
46
+
47
+.p2p-box .tabs-panel button {
48
+	clear: both;
49
+	display: block;
50
+	margin-top: 8px;
51
+}
52
+
53
+.p2p-search + .p2p-results,
54
+.p2p-search + .p2p-notice,
55
+.p2p-results + .p2p-navigation {
56
+	margin-top: 8px;
57
+}
58
+
59
+.p2p-results td,
60
+.p2p-connections td {
61
+	border-top: 1px solid #DFDFDF;
62
+}
63
+
64
+.p2p-connections th,
65
+.p2p-connections td,
66
+.p2p-results td {
67
+	padding: 3px 6px;
68
+}
69
+
70
+th.p2p-col-delete,
71
+td.p2p-col-delete,
72
+td.p2p-col-create {
73
+	padding: 0;
74
+}
75
+
76
+.p2p-results tr:first-child td {
77
+	border-top: 0;
78
+}
79
+
80
+.p2p-connections th {
81
+	background-color: #F1F1F1;
82
+	text-align: left;
83
+}
84
+
85
+.p2p-connections td input[type="text"] {
86
+	width: 100%;
87
+}
88
+
89
+.p2p-col-delete {
90
+	width: 16px;
91
+	border-right: 1px solid transparent;
92
+}
93
+
94
+.p2p-icon {
95
+	display: block;
96
+	height: 16px;
97
+	width: 16px;
98
+	opacity: 0.5;
99
+}
100
+
101
+.p2p-col-create div,
102
+.p2p-icon {
103
+	padding: 5px 6px;
104
+	vertical-align: middle;
105
+}
106
+
107
+td.p2p-col-create .p2p-icon {
108
+	padding: 0;
109
+}
110
+
111
+.p2p-col-create:hover,
112
+.p2p-col-delete:hover {
113
+	background-color: #f5f5f5;
114
+	border-right-color: #ddd;
115
+	cursor: pointer;
116
+}
117
+
118
+.p2p-col-create:hover .p2p-icon,
119
+.p2p-col-delete:hover .p2p-icon {
120
+	opacity: 1;
121
+}
122
+
123
+.p2p-col-delete .p2p-icon {
124
+	background: url("images/minus.png") no-repeat scroll 50% 50% transparent;
125
+}
126
+
127
+.p2p-col-create .p2p-icon {
128
+	background: url("images/plus.png") no-repeat scroll 50% 50% transparent;
129
+	float: left;
130
+	margin-right: 6px;
131
+}
132
+
133
+.p2p-box .post-state {
134
+	font-style: italic;
135
+}
136
+
137
+.p2p-box td img {
138
+	display: block;
139
+	margin: 2px 0;
140
+	max-height: 60px;
141
+	max-width: 80px;
142
+}
143
+
144
+td.p2p-col-order {
145
+	width: 13px;
146
+}
147
+
148
+tr:hover td.p2p-col-order {
149
+	cursor: move;
150
+	background: url("images/sort.png") no-repeat scroll 50% 50% transparent;
151
+}
152
+
153
+.p2p-search .p2p-spinner {
154
+	margin-left: -20px;
155
+	opacity: 0.8;
156
+	vertical-align: -0.3em;
157
+}
158
+
159
+.p2p-tab-search input {
160
+	background-color: transparent;
161
+	padding-right: 22px;
162
+	margin: 0;
163
+}
164
+
165
+.p2p-tab-create-post input[type="text"] {
166
+	width: 100%;
167
+	display: block;
168
+}
169
+
170
+/* Pagination */
171
+
172
+.p2p-navigation {
173
+	clear: both;
174
+	display: table;
175
+	overflow: hidden;
176
+}
177
+
178
+.p2p-navigation .button.inactive,
179
+.p2p-navigation .button.inactive:hover {
180
+	border-color: #bbb;
181
+	color: #aaa;
182
+	background: #f6f6f6;
183
+	text-shadow: none;
184
+	cursor: default;
185
+}
186
+
187
+.p2p-navigation div {
188
+	float: left;
189
+	line-height: 13px;
190
+	padding: 6px 5px 0;
191
+}
192
+
193
+.p2p-navigation .p2p-spinner {
194
+	margin-top: 5px;
195
+	margin-left: 5px;
196
+}
197
+
198
+
199
+/* RTL support */
200
+
201
+body.rtl .p2p-navigation div {
202
+	float: right;
203
+}
204
+
205
+body.rtl .p2p-search .p2p-spinner {
206
+	margin-left: 0;
207
+	margin-right: -20px;
208
+}
209
+
210
+body.rtl .p2p-tab-search input {
211
+	padding-left: 22px;
212
+	padding-right: 0;
213
+}
214
+
215
+body.rtl .p2p-navigation .p2p-spinner {
216
+	margin-right: 5px;
217
+}
218
+
219
+body.rtl .p2p-col-create,
220
+body.rtl .p2p-col-delete {
221
+	border-left: 1px solid transparent;
222
+	border-right: 0;
223
+}
224
+
225
+body.rtl .p2p-col-create:hover,
226
+body.rtl .p2p-col-delete:hover {
227
+	border-left-color: #ddd;
228
+}

+ 473
- 0
plugins/posts-to-posts/admin/box.js Переглянути файл

@@ -0,0 +1,473 @@
1
+(function() {
2
+  var Candidate, Candidates, CandidatesView, Connection, Connections, ConnectionsView, CreatePostView, ENTER_KEY, MetaboxView, get_mustache_template, remove_row, row_wait;
3
+
4
+  ENTER_KEY = 13;
5
+
6
+  row_wait = function($td) {
7
+    return $td.find('.p2p-icon').css('background-image', 'url(' + P2PAdminL10n.spinner + ')');
8
+  };
9
+
10
+  remove_row = function($td) {
11
+    var $table;
12
+    $table = $td.closest('table');
13
+    $td.closest('tr').remove();
14
+    if (!$table.find('tbody tr').length) {
15
+      return $table.hide();
16
+    }
17
+  };
18
+
19
+  get_mustache_template = function(name) {
20
+    return jQuery('#p2p-template-' + name).html();
21
+  };
22
+
23
+  // Class for representing a single connection candidate
24
+  Candidate = Backbone.Model.extend({});
25
+
26
+  // Class for representing a single connection
27
+  Connection = Backbone.Model.extend({});
28
+
29
+  // Class for holding search parameters; not really a model
30
+  Candidates = Backbone.Model.extend({
31
+    
32
+    // (Re)perform a search with the current parameters
33
+    sync: function() {
34
+      var params, _this = this;
35
+      params = {
36
+        subaction: 'search'
37
+      };
38
+      return this.ajax_request(params, function(response) {
39
+        var _ref = response.navigation;
40
+        _this.total_pages = (_ref ? _ref['total-pages-raw'] : void 0) || 1;
41
+        _this.trigger('sync', response);
42
+      });
43
+    },
44
+
45
+    // Validation function, called by Backbone when parameters are changed
46
+    validate: function(attrs) {
47
+      var _ref = attrs.paged;
48
+      if (0 < _ref && _ref <= this.total_pages) {
49
+        return null;
50
+      }
51
+      return 'invalid page';
52
+    }
53
+  });
54
+
55
+  // Class for holding a list of connections
56
+  Connections = Backbone.Collection.extend({
57
+    model: Connection,
58
+
59
+    // Create both a candidate item and a connection
60
+    createItemAndConnect: function(title) {
61
+      var data, _this = this;
62
+      data = {
63
+        subaction: 'create_post',
64
+        post_title: title
65
+      };
66
+      return this.ajax_request(data, function(response) {
67
+        _this.trigger('create', response);
68
+      });
69
+    },
70
+
71
+    // Create a connection from a candidate
72
+    create: function(candidate) {
73
+      var data, _this = this;
74
+      data = {
75
+        subaction: 'connect',
76
+        to: candidate.get('id')
77
+      };
78
+      return this.ajax_request(data, function(response) {
79
+        _this.trigger('create', response);
80
+      });
81
+    },
82
+
83
+    // Delete a connection
84
+    "delete": function(connection) {
85
+      var data, _this = this;
86
+      data = {
87
+        subaction: 'disconnect',
88
+        p2p_id: connection.get('id')
89
+      };
90
+      return this.ajax_request(data, function(response) {
91
+        _this.trigger('delete', response, connection);
92
+      });
93
+    },
94
+
95
+    // Delete all connections
96
+    clear: function() {
97
+      var data, _this = this;
98
+      data = {
99
+        subaction: 'clear_connections'
100
+      };
101
+      return this.ajax_request(data, function(response) {
102
+        _this.trigger('clear', response);
103
+      });
104
+    }
105
+  });
106
+
107
+  // View responsible for the connection list
108
+  ConnectionsView = Backbone.View.extend({
109
+
110
+    events: {
111
+      'click th.p2p-col-delete .p2p-icon': 'clear',
112
+      'click td.p2p-col-delete .p2p-icon': 'delete'
113
+    },
114
+
115
+    initialize: function(options) {
116
+      this.options = options;
117
+      this.maybe_make_sortable();
118
+      this.collection.on('create', this.afterCreate, this);
119
+      this.collection.on('clear', this.afterClear, this);
120
+    },
121
+
122
+    maybe_make_sortable: function() {
123
+      if (this.$('th.p2p-col-order').length) {
124
+        this.$('tbody').sortable({
125
+          handle: 'td.p2p-col-order',
126
+          helper: function(e, ui) {
127
+            ui.children().each(function() {
128
+              var $this;
129
+              $this = jQuery(this);
130
+              $this.width($this.width());
131
+            });
132
+            return ui;
133
+          }
134
+        });
135
+      }
136
+    },
137
+
138
+    clear: function(ev) {
139
+      var $td;
140
+      ev.preventDefault();
141
+      if (!confirm(P2PAdminL10n.deleteConfirmMessage)) {
142
+        return;
143
+      }
144
+      $td = jQuery(ev.target).closest('td');
145
+      row_wait($td);
146
+      this.collection.clear();
147
+    },
148
+
149
+    afterClear: function() {
150
+      this.$el.hide().find('tbody').html('');
151
+    },
152
+
153
+    "delete": function(ev) {
154
+      var $td, req;
155
+      ev.preventDefault();
156
+      $td = jQuery(ev.target).closest('td');
157
+      row_wait($td);
158
+      req = this.collection["delete"](new Connection({
159
+        id: $td.find('input').val()
160
+      }));
161
+      req.done(function() {
162
+        remove_row($td);
163
+      });
164
+    },
165
+
166
+    afterCreate: function(response) {
167
+      this.$el.show().find('tbody').append(response.row);
168
+      this.collection.trigger('append', response);
169
+    }
170
+  });
171
+
172
+  // View responsible for the candidate list
173
+  CandidatesView = Backbone.View.extend({
174
+
175
+    template: Mustache.compile(get_mustache_template('tab-list')),
176
+
177
+    events: {
178
+      'keypress :text': 'handleReturn',
179
+      'keyup :text': 'handleSearch',
180
+      'click .p2p-prev, .p2p-next': 'changePage',
181
+      'click td.p2p-col-create div': 'promote'
182
+    },
183
+
184
+    initialize: function(options) {
185
+      this.options = options;
186
+      this.spinner = options.spinner;
187
+      options.connections.on('delete', this.afterCandidatesRefreshed, this);
188
+      options.connections.on('clear', this.afterCandidatesRefreshed, this);
189
+      this.collection.on('sync', this.afterCandidatesRefreshed, this);
190
+      this.collection.on('error', this.afterInvalid, this);
191
+      this.collection.on('invalid', this.afterInvalid, this);
192
+    },
193
+
194
+    promote: function(ev) {
195
+      var $td, req, _this = this;
196
+      ev.preventDefault();
197
+      $td = jQuery(ev.target).closest('td');
198
+      row_wait($td);
199
+      var candidate = new Candidate({
200
+        id: $td.find('div').data('item-id')
201
+      });
202
+      req = this.options.connections.create(candidate);
203
+      req.done(function() {
204
+        if (_this.options.duplicate_connections) {
205
+          $td.find('.p2p-icon').css('background-image', '');
206
+        } else {
207
+          remove_row($td);
208
+        }
209
+      });
210
+    },
211
+
212
+    handleReturn: function(ev) {
213
+      if (ev.keyCode === ENTER_KEY) {
214
+        ev.preventDefault();
215
+      }
216
+    },
217
+
218
+    handleSearch: function(ev) {
219
+      var $searchInput, delayed,
220
+        _this = this;
221
+      if (delayed !== void 0) {
222
+        clearTimeout(delayed);
223
+      }
224
+      $searchInput = jQuery(ev.target);
225
+      delayed = setTimeout(function() {
226
+        var searchStr;
227
+        searchStr = $searchInput.val();
228
+        if (searchStr === _this.collection.get('s')) {
229
+          return;
230
+        }
231
+        _this.spinner.insertAfter($searchInput).show();
232
+        _this.collection.save({
233
+          's': searchStr,
234
+          'paged': 1
235
+        });
236
+      }, 400);
237
+    },
238
+
239
+    changePage: function(ev) {
240
+      var $navButton, new_page;
241
+      $navButton = jQuery(ev.currentTarget);
242
+      new_page = this.collection.get('paged');
243
+      if ($navButton.hasClass('p2p-prev')) {
244
+        new_page--;
245
+      } else {
246
+        new_page++;
247
+      }
248
+      this.spinner.appendTo(this.$('.p2p-navigation'));
249
+      this.collection.save('paged', new_page);
250
+    },
251
+
252
+    afterCandidatesRefreshed: function(response) {
253
+      this.spinner.remove();
254
+      this.$('button, .p2p-results, .p2p-navigation, .p2p-notice').remove();
255
+      if ('string' !== typeof response) {
256
+        response = this.template(response);
257
+      }
258
+      this.$el.append(response);
259
+    },
260
+    afterInvalid: function() {
261
+      this.spinner.remove();
262
+    }
263
+  });
264
+
265
+  // View responsible for the post creation UI
266
+  CreatePostView = Backbone.View.extend({
267
+
268
+    events: {
269
+      'click button': 'createItem',
270
+      'keypress :text': 'handleReturn'
271
+    },
272
+
273
+    initialize: function(options) {
274
+      this.options = options;
275
+      this.createButton = this.$('button');
276
+      this.createInput = this.$(':text');
277
+    },
278
+
279
+    handleReturn: function(ev) {
280
+      if (ev.keyCode === ENTER_KEY) {
281
+        this.createButton.click();
282
+        ev.preventDefault();
283
+      }
284
+    },
285
+
286
+    createItem: function(ev) {
287
+      var req, title, _this = this;
288
+      ev.preventDefault();
289
+      if (this.createButton.hasClass('inactive')) {
290
+        return false;
291
+      }
292
+      title = this.createInput.val();
293
+      if (title === '') {
294
+        this.createInput.focus();
295
+        return;
296
+      }
297
+      this.createButton.addClass('inactive');
298
+      req = this.collection.createItemAndConnect(title);
299
+      req.done(function() {
300
+        _this.createInput.val('');
301
+        _this.createButton.removeClass('inactive');
302
+      });
303
+    }
304
+  });
305
+
306
+  // View responsible for the entire metabox
307
+  MetaboxView = Backbone.View.extend({
308
+
309
+    events: {
310
+      'click .p2p-toggle-tabs': 'toggleTabs',
311
+      'click .wp-tab-bar li': 'setActiveTab'
312
+    },
313
+
314
+    initialize: function(options) {
315
+      this.options = options;
316
+      this.spinner = options.spinner;
317
+      this.initializedCandidates = false;
318
+      options.connections.on('append', this.afterConnectionAppended, this);
319
+      options.connections.on('clear', this.afterConnectionDeleted, this);
320
+      options.connections.on('delete', this.afterConnectionDeleted, this);
321
+    },
322
+
323
+    toggleTabs: function(ev) {
324
+      var $tabs;
325
+      ev.preventDefault();
326
+      $tabs = this.$('.p2p-create-connections-tabs');
327
+      $tabs.toggle();
328
+      if (!this.initializedCandidates && $tabs.is(':visible')) {
329
+        this.options.candidates.sync();
330
+        this.initializedCandidates = true;
331
+      }
332
+    },
333
+
334
+    setActiveTab: function(ev) {
335
+      var $tab;
336
+      ev.preventDefault();
337
+      $tab = jQuery(ev.currentTarget);
338
+      this.$('.wp-tab-bar li').removeClass('wp-tab-active');
339
+      $tab.addClass('wp-tab-active');
340
+      this.$el.find('.tabs-panel').hide().end().find($tab.data('ref')).show().find(':text').focus();
341
+    },
342
+
343
+    afterConnectionAppended: function(response) {
344
+      if ('one' === this.options.cardinality) {
345
+        this.$('.p2p-create-connections').hide();
346
+      }
347
+    },
348
+
349
+    afterConnectionDeleted: function(response) {
350
+      if ('one' === this.options.cardinality) {
351
+        this.$('.p2p-create-connections').show();
352
+      }
353
+    }
354
+  });
355
+
356
+  window.P2PAdmin = {
357
+    Candidate: Candidate,
358
+    Connection: Connection,
359
+    boxes: {}
360
+  };
361
+
362
+  jQuery(function() {
363
+    // Polyfill for browsers that don't support the placeholder attribute
364
+    if (!jQuery('<input placeholder="1" />')[0].placeholder) {
365
+      function setVal() {
366
+        var $this;
367
+        $this = jQuery(this);
368
+        if (!$this.val()) {
369
+          $this.val($this.attr('placeholder'));
370
+          $this.addClass('p2p-placeholder');
371
+        }
372
+      };
373
+
374
+      function clearVal() {
375
+        var $this;
376
+        $this = jQuery(this);
377
+        if ($this.hasClass('p2p-placeholder')) {
378
+          $this.val('');
379
+          $this.removeClass('p2p-placeholder');
380
+        }
381
+      };
382
+      jQuery('.p2p-search input[placeholder]').each(setVal).focus(clearVal).blur(setVal);
383
+    }
384
+
385
+    Mustache.compilePartial('table-row', get_mustache_template('table-row'));
386
+
387
+    jQuery('.p2p-box').each(function() {
388
+      var $metabox, $spinner, candidates, candidatesView, connections, connectionsView, createPostView, ctype, metaboxView;
389
+
390
+      $metabox = jQuery(this);
391
+
392
+      $spinner = jQuery('<img>', {
393
+        'src': P2PAdminL10n.spinner,
394
+        'class': 'p2p-spinner'
395
+      });
396
+
397
+      candidates = new Candidates({
398
+        's': '',
399
+        'paged': 1
400
+      });
401
+      candidates.total_pages = $metabox.find('.p2p-total').data('num') || 1;
402
+
403
+      ctype = {
404
+        p2p_type: $metabox.data('p2p_type'),
405
+        direction: $metabox.data('direction'),
406
+        from: jQuery('#post_ID').val()
407
+      };
408
+
409
+      // All ajax requests should be done through this function
410
+      function ajax_request(options, callback) {
411
+        var params = _.extend({}, options, candidates.attributes, ctype, {
412
+          action: 'p2p_box',
413
+          nonce: P2PAdminL10n.nonce
414
+        });
415
+
416
+        return jQuery.post(ajaxurl, params, function(response) {
417
+          var e;
418
+          try {
419
+            response = jQuery.parseJSON(response);
420
+          } catch (_error) {
421
+            e = _error;
422
+            if (typeof console !== "undefined" && console !== null) {
423
+              console.error('Malformed response', response);
424
+            }
425
+            return;
426
+          }
427
+          if (response.error) {
428
+            return alert(response.error);
429
+          } else {
430
+            return callback(response);
431
+          }
432
+        });
433
+      }
434
+
435
+      candidates.ajax_request = ajax_request;
436
+
437
+      connections = new Connections();
438
+      connections.ajax_request = ajax_request;
439
+
440
+      connectionsView = new ConnectionsView({
441
+        el: $metabox.find('.p2p-connections'),
442
+        collection: connections,
443
+        candidates: candidates
444
+      });
445
+
446
+      candidatesView = new CandidatesView({
447
+        el: $metabox.find('.p2p-tab-search'),
448
+        collection: candidates,
449
+        connections: connections,
450
+        spinner: $spinner,
451
+        duplicate_connections: $metabox.data('duplicate_connections')
452
+      });
453
+
454
+      createPostView = new CreatePostView({
455
+        el: $metabox.find('.p2p-tab-create-post'),
456
+        collection: connections
457
+      });
458
+
459
+      metaboxView = new MetaboxView({
460
+        el: $metabox,
461
+        spinner: $spinner,
462
+        cardinality: $metabox.data('cardinality'),
463
+        candidates: candidates,
464
+        connections: connections
465
+      });
466
+
467
+      P2PAdmin.boxes[ctype.p2p_type] = {
468
+        candidates: candidates,
469
+        connections: connections
470
+      };
471
+    });
472
+  });
473
+}());

+ 326
- 0
plugins/posts-to-posts/admin/box.php Переглянути файл

@@ -0,0 +1,326 @@
1
+<?php
2
+
3
+/**
4
+ * A metabox in wp-admin
5
+ */
6
+class P2P_Box {
7
+	private $ctype;
8
+
9
+	private $args;
10
+
11
+	private $columns;
12
+
13
+	private static $enqueued_scripts = false;
14
+
15
+	private static $admin_box_qv = array(
16
+		'update_post_term_cache' => false,
17
+		'update_post_meta_cache' => false,
18
+		'post_status' => 'any',
19
+	);
20
+
21
+	function __construct( $args, $columns, $ctype ) {
22
+		$this->args = $args;
23
+
24
+		$this->columns = $columns;
25
+
26
+		$this->ctype = $ctype;
27
+
28
+		$this->labels = $this->ctype->get( 'opposite', 'labels' );
29
+	}
30
+
31
+	public function init_scripts() {
32
+
33
+		if ( self::$enqueued_scripts )
34
+			return;
35
+
36
+		wp_enqueue_style( 'p2p-box', plugins_url( 'box.css', __FILE__ ),
37
+			array(), P2P_PLUGIN_VERSION );
38
+
39
+		wp_register_script( 'mustache', plugins_url( 'mustache.js', __FILE__ ),
40
+			array(), '0.7.2', true );
41
+
42
+		wp_enqueue_script( 'p2p-box', plugins_url( 'box.js', __FILE__ ),
43
+			array( 'backbone', 'mustache' ), P2P_PLUGIN_VERSION, true );
44
+
45
+		wp_localize_script( 'p2p-box', 'P2PAdminL10n', array(
46
+			'nonce' => wp_create_nonce( P2P_BOX_NONCE ),
47
+			'spinner' => admin_url( 'images/wpspin_light.gif' ),
48
+			'deleteConfirmMessage' => __( 'Are you sure you want to delete all connections?', P2P_TEXTDOMAIN ),
49
+		) );
50
+
51
+		self::$enqueued_scripts = true;
52
+
53
+		add_action( 'admin_footer', array( __CLASS__, 'add_templates' ) );
54
+	}
55
+
56
+	static function add_templates() {
57
+		self::add_template( 'tab-list' );
58
+		self::add_template( 'table-row' );
59
+	}
60
+
61
+	private static function add_template( $slug ) {
62
+		echo html( 'script', array(
63
+			'type' => 'text/html',
64
+			'id' => "p2p-template-$slug"
65
+		), file_get_contents( dirname( __FILE__ ) . "/templates/$slug.html" ) );
66
+	}
67
+
68
+	function render( $item ) {
69
+		$extra_qv = array_merge( self::$admin_box_qv, array(
70
+			'p2p:context' => 'admin_box',
71
+			'p2p:per_page' => -1
72
+		) );
73
+
74
+		$this->connected_items = $this->ctype->get_connected( $item, $extra_qv, 'abstract' )->items;
75
+
76
+		$data = array(
77
+			'attributes' => $this->render_data_attributes(),
78
+			'connections' => $this->render_connections_table( $item ),
79
+			'create-connections' => $this->render_create_connections( $item ),
80
+			'help' => isset( $this->labels->help ) ? $this->labels->help : ''
81
+		);
82
+
83
+		echo P2P_Mustache::render( 'box', $data );
84
+	}
85
+
86
+	protected function render_data_attributes() {
87
+		$data_attr = array(
88
+			'p2p_type' => $this->ctype->name,
89
+			'duplicate_connections' => $this->ctype->duplicate_connections,
90
+			'cardinality' => $this->ctype->get( 'opposite', 'cardinality' ),
91
+			'direction' => $this->ctype->get_direction()
92
+		);
93
+
94
+		$data_attr_str = array();
95
+		foreach ( $data_attr as $key => $value )
96
+			$data_attr_str[] = "data-$key='" . $value . "'";
97
+
98
+		return implode( ' ', $data_attr_str );
99
+	}
100
+
101
+	protected function render_connections_table( $item ) {
102
+		$data = array();
103
+
104
+		if ( empty( $this->connected_items ) )
105
+			$data['hide'] = 'style="display:none"';
106
+
107
+		$tbody = array();
108
+		foreach ( $this->connected_items as $item ) {
109
+			$tbody[] = $this->connection_row( $item->p2p_id, $item );
110
+		}
111
+		$data['tbody'] = $tbody;
112
+
113
+		foreach ( $this->columns as $key => $field ) {
114
+			$data['thead'][] = array(
115
+				'column' => $key,
116
+				'title' => $field->get_title()
117
+			);
118
+		}
119
+
120
+		return $data;
121
+	}
122
+
123
+	protected function render_create_connections( $item ) {
124
+		$data = array(
125
+			'label' => $this->labels->create,
126
+		);
127
+
128
+		if ( 'one' == $this->ctype->get( 'opposite', 'cardinality' ) ) {
129
+			if ( !empty( $this->connected_items ) )
130
+				$data['hide'] = 'style="display:none"';
131
+		}
132
+
133
+		// Search tab
134
+		$tab_content = P2P_Mustache::render( 'tab-search', array(
135
+			'placeholder' => $this->labels->search_items,
136
+		) );
137
+
138
+		$data['tabs'][] = array(
139
+			'tab-id' => 'search',
140
+			'tab-title' => __( 'Search', P2P_TEXTDOMAIN ),
141
+			'is-active' => array(true),
142
+			'tab-content' => $tab_content
143
+		);
144
+
145
+		// "Create post" tab
146
+		if ( $this->can_create_post() ) {
147
+			$tab_content = P2P_Mustache::render( 'tab-create-post', array(
148
+				'title' => $this->labels->add_new_item
149
+			) );
150
+
151
+			$data['tabs'][] = array(
152
+				'tab-id' => 'create-post',
153
+				'tab-title' => $this->labels->new_item,
154
+				'tab-content' => $tab_content
155
+			);
156
+		}
157
+
158
+		$data['show-tab-headers'] = count( $data['tabs'] ) > 1 ? array(true) : false;
159
+
160
+		return $data;
161
+	}
162
+
163
+	protected function connection_row( $p2p_id, $item, $render = false ) {
164
+		
165
+		$item->title = apply_filters( 'p2p_connected_title', $item->get_title(), $item->get_object(), $this->ctype );
166
+
167
+		$data = array();
168
+
169
+		foreach ( $this->columns as $key => $field ) {
170
+			$data['columns'][] = array(
171
+				'column' => $key,
172
+				'content' => $field->render( $p2p_id, $item )
173
+			);
174
+		}
175
+
176
+		if ( !$render )
177
+			return $data;
178
+
179
+		return P2P_Mustache::render( 'table-row', $data );
180
+	}
181
+
182
+	protected function candidate_row( $item ) {
183
+		$title = apply_filters( 'p2p_candidate_title', $item->get_title(), $item->get_object(), $this->ctype );
184
+
185
+		$title_data = array_merge( $this->columns['title']->get_data( $item ), array(
186
+			'title' => $title,
187
+			'item-id' => $item->get_id(),
188
+		) );
189
+
190
+		$data = array();
191
+
192
+		$data['columns'][] = array(
193
+			'column' => 'create',
194
+			'content' => P2P_Mustache::render( 'column-create', $title_data )
195
+		);
196
+
197
+		return $data;
198
+	}
199
+
200
+	protected function candidate_rows( $current_post_id, $page = 1, $search = '' ) {
201
+		$extra_qv = array_merge( self::$admin_box_qv, array(
202
+			'p2p:context' => 'admin_box_candidates',
203
+			'p2p:search' => $search,
204
+			'p2p:page' => $page,
205
+			'p2p:per_page' => 5
206
+		) );
207
+
208
+		$candidate = $this->ctype->get_connectable( $current_post_id, $extra_qv, 'abstract' );
209
+
210
+		if ( empty( $candidate->items ) ) {
211
+			return html( 'div class="p2p-notice"', $this->labels->not_found );
212
+		}
213
+
214
+		$data = array();
215
+
216
+		foreach ( $candidate->items as $item ) {
217
+			$data['rows'][] = $this->candidate_row( $item );
218
+		}
219
+
220
+		if ( $candidate->total_pages > 1 ) {
221
+			$data['navigation'] = array(
222
+				'current-page' => number_format_i18n( $candidate->current_page ),
223
+				'total-pages' => number_format_i18n( $candidate->total_pages ),
224
+
225
+				'total-pages-raw' => $candidate->total_pages,
226
+
227
+				'prev-inactive' => ( 1 == $candidate->current_page ) ? 'inactive' : '',
228
+				'next-inactive' => ( $candidate->total_pages == $candidate->current_page ) ? 'inactive' : '',
229
+
230
+				'prev-label' =>  __( 'previous', P2P_TEXTDOMAIN ),
231
+				'next-label' =>  __( 'next', P2P_TEXTDOMAIN ),
232
+				'of-label' => __( 'of', P2P_TEXTDOMAIN ),
233
+			);
234
+		}
235
+
236
+		return $data;
237
+	}
238
+
239
+
240
+	// Ajax handlers
241
+
242
+	public function ajax_create_post() {
243
+		if ( !$this->can_create_post() )
244
+			die( -1 );
245
+
246
+		$args = array(
247
+			'post_title' => $_POST['post_title'],
248
+			'post_author' => get_current_user_id(),
249
+			'post_type' => $this->ctype->get( 'opposite', 'side' )->first_post_type()
250
+		);
251
+
252
+		$from = absint( $_POST['from'] );
253
+
254
+		$args = apply_filters( 'p2p_new_post_args', $args, $this->ctype, $from );
255
+
256
+		$this->safe_connect( wp_insert_post( $args ) );
257
+	}
258
+
259
+	public function ajax_connect() {
260
+		$this->safe_connect( $_POST['to'] );
261
+	}
262
+
263
+	private function safe_connect( $to ) {
264
+		$from = absint( $_POST['from'] );
265
+		$to = absint( $to );
266
+
267
+		if ( !$from || !$to )
268
+			die(-1);
269
+
270
+		$p2p_id = $this->ctype->connect( $from, $to );
271
+
272
+		self::maybe_send_error( $p2p_id );
273
+
274
+		$item = $this->ctype->get( 'opposite','side')->item_recognize( $to );
275
+
276
+		$out = array(
277
+			'row' => $this->connection_row( $p2p_id, $item, true )
278
+		);
279
+
280
+		die( json_encode( $out ) );
281
+	}
282
+
283
+	public function ajax_disconnect() {
284
+		p2p_delete_connection( $_POST['p2p_id'] );
285
+
286
+		$this->refresh_candidates();
287
+	}
288
+
289
+	public function ajax_clear_connections() {
290
+		$r = $this->ctype->disconnect( $_POST['from'], 'any' );
291
+
292
+		self::maybe_send_error( $r );
293
+
294
+		$this->refresh_candidates();
295
+	}
296
+
297
+	protected static function maybe_send_error( $r ) {
298
+		if ( !is_wp_error( $r ) )
299
+			return;
300
+
301
+		$out = array(
302
+			'error' => $r->get_error_message()
303
+		);
304
+
305
+		die( json_encode( $out ) );
306
+	}
307
+
308
+	public function ajax_search() {
309
+		$this->refresh_candidates();
310
+	}
311
+
312
+	private function refresh_candidates() {
313
+		die( json_encode( $this->candidate_rows(
314
+			$_REQUEST['from'], $_REQUEST['paged'], $_REQUEST['s'] ) ) );
315
+	}
316
+
317
+	protected function can_create_post() {
318
+		if ( !$this->args->can_create_post )
319
+			return false;
320
+
321
+		$side = $this->ctype->get( 'opposite', 'side' );
322
+
323
+		return $side->can_create_item();
324
+	}
325
+}
326
+

+ 24
- 0
plugins/posts-to-posts/admin/column-factory.php Переглянути файл

@@ -0,0 +1,24 @@
1
+<?php
2
+
3
+class P2P_Column_Factory extends P2P_Factory {
4
+
5
+	protected $key = 'admin_column';
6
+
7
+	function __construct() {
8
+		parent::__construct();
9
+
10
+		add_action( 'load-edit.php', array( $this, 'add_items' ) );
11
+		add_action( 'load-users.php', array( $this, 'add_items' ) );
12
+	}
13
+
14
+	function add_item( $directed, $object_type, $post_type, $title ) {
15
+		$class = 'P2P_Column_' . ucfirst( $object_type );
16
+		$column = new $class( $directed );
17
+
18
+		$screen = get_current_screen();
19
+
20
+		add_filter( "manage_{$screen->id}_columns", array( $column, 'add_column' ) );
21
+		add_action( 'admin_print_styles', array( $column, 'styles' ) );
22
+	}
23
+}
24
+

+ 36
- 0
plugins/posts-to-posts/admin/column-post.php Переглянути файл

@@ -0,0 +1,36 @@
1
+<?php
2
+
3
+class P2P_Column_Post extends P2P_Column {
4
+
5
+	function __construct( $directed ) {
6
+		parent::__construct( $directed );
7
+
8
+		$screen = get_current_screen();
9
+
10
+		add_action( "manage_{$screen->post_type}_posts_custom_column", array( $this, 'display_column' ), 10, 2 );
11
+	}
12
+
13
+	protected function get_items() {
14
+		global $wp_query;
15
+
16
+		return $wp_query->posts;
17
+	}
18
+
19
+	function get_admin_link( $item ) {
20
+		$args = array(
21
+			'connected_type' => $this->ctype->name,
22
+			'connected_direction' => $this->ctype->flip_direction()->get_direction(),
23
+			'connected_items' => $item->get_id(),
24
+			'post_type' => get_current_screen()->post_type
25
+		);
26
+
27
+		$admin_link = apply_filters( "p2p_post_admin_column_link", add_query_arg( $args, admin_url( 'edit.php' ) ), $item );
28
+
29
+		return $admin_link;
30
+	}
31
+
32
+	function display_column( $column, $item_id ) {
33
+		echo parent::render_column( $column, $item_id );
34
+	}
35
+}
36
+

+ 48
- 0
plugins/posts-to-posts/admin/column-user.php Переглянути файл

@@ -0,0 +1,48 @@
1
+<?php
2
+
3
+class P2P_Column_User extends P2P_Column {
4
+
5
+	function __construct( $directed ) {
6
+		parent::__construct( $directed );
7
+
8
+		add_action( 'pre_user_query', array( __CLASS__, 'user_query' ), 9 );
9
+
10
+		add_filter( 'manage_users_custom_column', array( $this, 'display_column' ), 10, 3 );
11
+	}
12
+
13
+	protected function get_items() {
14
+		global $wp_list_table;
15
+
16
+		return $wp_list_table->items;
17
+	}
18
+
19
+	// Add the query vars to the global user query (on the user admin screen)
20
+	static function user_query( $query ) {
21
+		if ( isset( $query->_p2p_capture ) )
22
+			return;
23
+
24
+		// Don't overwrite existing P2P query
25
+		if ( isset( $query->query_vars['connected_type'] ) )
26
+			return;
27
+
28
+		_p2p_append( $query->query_vars, wp_array_slice_assoc( $_GET,
29
+			P2P_URL_Query::get_custom_qv() ) );
30
+	}
31
+
32
+	function get_admin_link( $item ) {
33
+		$args = array(
34
+			'connected_type' => $this->ctype->name,
35
+			'connected_direction' => $this->ctype->flip_direction()->get_direction(),
36
+			'connected_items' => $item->get_id(),
37
+		);
38
+
39
+		$admin_link = apply_filters( "p2p_user_admin_column_link", add_query_arg( $args, admin_url( 'users.php' ) ), $item );
40
+
41
+		return $admin_link;
42
+	}
43
+
44
+	function display_column( $content, $column, $item_id ) {
45
+		return $content . parent::render_column( $column, $item_id );
46
+	}
47
+}
48
+

+ 77
- 0
plugins/posts-to-posts/admin/column.php Переглянути файл

@@ -0,0 +1,77 @@
1
+<?php
2
+
3
+/**
4
+ * A column in a list table in wp-admin
5
+ */
6
+abstract class P2P_Column {
7
+
8
+	protected $ctype;
9
+
10
+	protected $connected = array();
11
+
12
+	function __construct( $directed ) {
13
+		$this->ctype = $directed;
14
+
15
+		$this->column_id = sprintf( 'p2p-%s-%s',
16
+			$this->ctype->get_direction(),
17
+			$this->ctype->name
18
+		);
19
+	}
20
+
21
+	function add_column( $columns ) {
22
+		$this->prepare_items();
23
+
24
+		$labels = $this->ctype->get( 'current', 'labels' );
25
+
26
+		$title = isset( $labels->column_title )
27
+			? $labels->column_title
28
+			: $this->ctype->get( 'current', 'title' );
29
+
30
+		return array_splice( $columns, 0, -1 ) + array( $this->column_id => $title ) + $columns;
31
+	}
32
+
33
+	protected abstract function get_items();
34
+
35
+	protected function prepare_items() {
36
+		$items = $this->get_items();
37
+
38
+		$extra_qv = array(
39
+			'p2p:per_page' => -1,
40
+			'p2p:context' => 'admin_column'
41
+		);
42
+
43
+		$connected = $this->ctype->get_connected( $items, $extra_qv, 'abstract' );
44
+
45
+		$this->connected = scb_list_group_by( $connected->items, '_p2p_get_other_id' );
46
+	}
47
+
48
+	function styles() {
49
+?>
50
+<style type="text/css">
51
+.column-<?php echo $this->column_id; ?> ul {
52
+	margin-top: 0;
53
+	margin-bottom: 0;
54
+}
55
+</style>
56
+<?php
57
+	}
58
+
59
+	abstract function get_admin_link( $item );
60
+
61
+	protected function render_column( $column, $item_id ) {
62
+		if ( $this->column_id != $column )
63
+			return;
64
+
65
+		if ( !isset( $this->connected[ $item_id ] ) )
66
+			return;
67
+
68
+		$out = '<ul>';
69
+		foreach ( $this->connected[ $item_id ] as $item ) {
70
+			$out .= html( 'li', html_link( $this->get_admin_link( $item ), $item->get_title() ) );
71
+		}
72
+		$out .= '</ul>';
73
+
74
+		return $out;
75
+	}
76
+}
77
+

+ 19
- 0
plugins/posts-to-posts/admin/dropdown-factory.php Переглянути файл

@@ -0,0 +1,19 @@
1
+<?php
2
+
3
+class P2P_Dropdown_Factory extends P2P_Factory {
4
+
5
+	protected $key = 'admin_dropdown';
6
+
7
+	function __construct() {
8
+		parent::__construct();
9
+
10
+		add_action( 'load-edit.php', array( $this, 'add_items' ) );
11
+		add_action( 'load-users.php', array( $this, 'add_items' ) );
12
+	}
13
+
14
+	function add_item( $directed, $object_type, $post_type, $title ) {
15
+		$class = 'P2P_Dropdown_' . ucfirst( $object_type );
16
+		$item = new $class( $directed, $title );
17
+	}
18
+}
19
+

+ 17
- 0
plugins/posts-to-posts/admin/dropdown-post.php Переглянути файл

@@ -0,0 +1,17 @@
1
+<?php
2
+
3
+class P2P_Dropdown_Post extends P2P_Dropdown {
4
+
5
+	function __construct( $directed, $title ) {
6
+		parent::__construct( $directed, $title );
7
+
8
+		add_filter( 'request', array( __CLASS__, 'massage_query' ) );
9
+
10
+		add_action( 'restrict_manage_posts', array( $this, 'show_dropdown' ) );
11
+	}
12
+
13
+	static function massage_query( $request ) {
14
+		return array_merge( $request, self::get_qv() );
15
+	}
16
+}
17
+

+ 37
- 0
plugins/posts-to-posts/admin/dropdown-user.php Переглянути файл

@@ -0,0 +1,37 @@
1
+<?php
2
+
3
+class P2P_Dropdown_User extends P2P_Dropdown_Post {
4
+
5
+	function __construct( $directed, $title ) {
6
+		parent::__construct( $directed, $title );
7
+
8
+		add_action( 'pre_user_query', array( __CLASS__, 'massage_query' ), 9 );
9
+
10
+		add_action( 'restrict_manage_users', array( $this, 'show_dropdown' ) );
11
+	}
12
+
13
+	static function massage_query( $query ) {
14
+		if ( isset( $query->_p2p_capture ) )
15
+			return;
16
+
17
+		// Don't overwrite existing P2P query
18
+		if ( isset( $query->query_vars['connected_type'] ) )
19
+			return;
20
+
21
+		_p2p_append( $query->query_vars, self::get_qv() );
22
+	}
23
+
24
+	protected function render_dropdown() {
25
+		return html( 'div', array(
26
+			'style' => 'float: right; margin-left: 16px'
27
+		),
28
+			parent::render_dropdown(),
29
+			html( 'input', array(
30
+				'type' => 'submit',
31
+				'class' => 'button',
32
+				'value' => __( 'Filter', P2P_TEXTDOMAIN )
33
+			) )
34
+		);
35
+	}
36
+}
37
+

+ 73
- 0
plugins/posts-to-posts/admin/dropdown.php Переглянути файл

@@ -0,0 +1,73 @@
1
+<?php
2
+
3
+/**
4
+ * A dropdown above a list table in wp-admin
5
+ */
6
+abstract class P2P_Dropdown {
7
+
8
+	protected $ctype;
9
+	protected $title;
10
+
11
+	function __construct( $directed, $title ) {
12
+		$this->ctype = $directed;
13
+		$this->title = $title;
14
+	}
15
+
16
+	function show_dropdown() {
17
+		echo $this->render_dropdown();
18
+	}
19
+
20
+	protected function render_dropdown() {
21
+		$direction = $this->ctype->flip_direction()->get_direction();
22
+
23
+		$labels = $this->ctype->get( 'current', 'labels' );
24
+
25
+		if ( isset( $labels->dropdown_title ) )
26
+			$title = $labels->dropdown_title;
27
+		elseif ( isset( $labels->column_title ) )
28
+			$title = $labels->column_title;
29
+		else
30
+			$title = $this->title;
31
+
32
+		return scbForms::input( array(
33
+			'type' => 'select',
34
+			'name' => array( 'p2p', $this->ctype->name, $direction ),
35
+			'choices' => self::get_choices( $this->ctype ),
36
+			'text' => $title,
37
+		), $_GET );
38
+	}
39
+
40
+	protected static function get_qv() {
41
+		if ( !isset( $_GET['p2p'] ) )
42
+			return array();
43
+
44
+		$args = array();
45
+
46
+		$tmp = reset( $_GET['p2p'] );
47
+
48
+		$args['connected_type'] = key( $_GET['p2p'] );
49
+
50
+		list( $args['connected_direction'], $args['connected_items'] ) = each( $tmp );
51
+
52
+		if ( !$args['connected_items'] )
53
+			return array();
54
+
55
+		return $args;
56
+	}
57
+
58
+	protected static function get_choices( $directed ) {
59
+		$extra_qv = array(
60
+			'p2p:per_page' => -1,
61
+			'p2p:context' => 'admin_dropdown'
62
+		);
63
+
64
+		$connected = $directed->get_connected( 'any', $extra_qv, 'abstract' );
65
+
66
+		$options = array();
67
+		foreach ( $connected->items as $item )
68
+			$options[ $item->get_id() ] = $item->get_title();
69
+
70
+		return $options;
71
+	}
72
+}
73
+

+ 103
- 0
plugins/posts-to-posts/admin/factory.php Переглянути файл

@@ -0,0 +1,103 @@
1
+<?php
2
+
3
+abstract class P2P_Factory {
4
+
5
+	protected $key;
6
+
7
+	protected $queue = array();
8
+
9
+	function __construct() {
10
+		add_action( 'p2p_registered_connection_type', array( $this, 'check_ctype' ), 10, 2 );
11
+	}
12
+
13
+	// Check if a newly registered connection type needs an item to be produced.
14
+	function check_ctype( $ctype, $args ) {
15
+		$sub_args = $this->expand_arg( $args );
16
+
17
+		if ( !$sub_args['show'] )
18
+			return false;
19
+
20
+		$this->queue[ $ctype->name ] = (object) $sub_args;
21
+	}
22
+
23
+	// Collect sub-args from main connection type args and set defaults
24
+	protected function expand_arg( $args ) {
25
+		if ( isset( $args[ $this->key ] ) ) {
26
+			$sub_args = $args[ $this->key ];
27
+
28
+			if ( !is_array( $sub_args ) ) {
29
+				$sub_args = array( 'show' => $sub_args );
30
+			}
31
+		} else {
32
+			$sub_args = array( 'show' => false );
33
+		}
34
+
35
+		$sub_args = wp_parse_args( $sub_args, array(
36
+			'show' => 'any',
37
+		) );
38
+
39
+		return $sub_args;
40
+	}
41
+
42
+	// Begin processing item queue for a particular screen.
43
+	function add_items() {
44
+		$screen = get_current_screen();
45
+
46
+		$screen_map = array(
47
+			'edit' => 'post',
48
+			'users' => 'user'
49
+		);
50
+
51
+		if ( !isset( $screen_map[ $screen->base ] ) )
52
+			return;
53
+
54
+		$object_type = $screen_map[ $screen->base ];
55
+
56
+		$this->filter( $object_type, $screen->post_type );
57
+	}
58
+
59
+	// Filter item queue based on object type.
60
+	function filter( $object_type, $post_type ) {
61
+		foreach ( $this->queue as $p2p_type => $args ) {
62
+			$ctype = p2p_type( $p2p_type );
63
+
64
+			$directions = self::determine_directions( $ctype, $object_type, $post_type, $args->show );
65
+
66
+			$title = self::get_title( $directions, $ctype );
67
+
68
+			foreach ( $directions as $direction ) {
69
+				$key = ( 'to' == $direction ) ? 'to' : 'from';
70
+
71
+				$directed = $ctype->set_direction( $direction );
72
+
73
+				$this->add_item( $directed, $object_type, $post_type, $title[$key] );
74
+			}
75
+		}
76
+	}
77
+
78
+	// Produce an item and add it to the screen.
79
+	abstract function add_item( $directed, $object_type, $post_type, $title );
80
+
81
+	protected static function get_title( $directions, $ctype ) {
82
+		$title = array(
83
+			'from' => $ctype->get_field( 'title', 'from' ),
84
+			'to' => $ctype->get_field( 'title', 'to' )
85
+		);
86
+
87
+		if ( count( $directions ) > 1 && $title['from'] == $title['to'] ) {
88
+			$title['from'] .= __( ' (from)', P2P_TEXTDOMAIN );
89
+			$title['to']   .= __( ' (to)', P2P_TEXTDOMAIN );
90
+		}
91
+
92
+		return $title;
93
+	}
94
+
95
+	protected static function determine_directions( $ctype, $object_type, $post_type, $show_ui ) {
96
+		$direction = $ctype->direction_from_types( $object_type, $post_type );
97
+		if ( !$direction )
98
+			return array();
99
+
100
+		return $ctype->strategy->directions_for_admin( $direction, $show_ui );
101
+	}
102
+}
103
+

+ 23
- 0
plugins/posts-to-posts/admin/field-delete.php Переглянути файл

@@ -0,0 +1,23 @@
1
+<?php
2
+
3
+class P2P_Field_Delete implements P2P_Field {
4
+
5
+	function get_title() {
6
+		$data = array(
7
+			'title' => __( 'Delete all connections', P2P_TEXTDOMAIN )
8
+		);
9
+
10
+		return P2P_Mustache::render( 'column-delete-all', $data );
11
+	}
12
+
13
+	function render( $p2p_id, $_ ) {
14
+		$data = array(
15
+			'p2p_id' => $p2p_id,
16
+			'title' => __( 'Delete connection', P2P_TEXTDOMAIN )
17
+		);
18
+
19
+		return P2P_Mustache::render( 'column-delete', $data );
20
+	}
21
+}
22
+
23
+

+ 27
- 0
plugins/posts-to-posts/admin/field-generic.php Переглянути файл

@@ -0,0 +1,27 @@
1
+<?php
2
+
3
+class P2P_Field_Generic implements P2P_Field {
4
+
5
+	protected $key;
6
+	protected $data;
7
+
8
+	function __construct( $key, $data ) {
9
+		$this->key = $key;
10
+		$this->data = $data;
11
+	}
12
+
13
+	function get_title() {
14
+		return $this->data['title'];
15
+	}
16
+
17
+	function render( $p2p_id, $_ ) {
18
+		$args = $this->data;
19
+		$args['name'] = array( 'p2p_meta', $p2p_id, $this->key );
20
+
21
+		if ( 'select' == $args['type'] && !isset( $args['text'] ) )
22
+			$args['text'] = '';
23
+
24
+		return scbForms::input_from_meta( $args, $p2p_id, 'p2p' );
25
+	}
26
+}
27
+

+ 23
- 0
plugins/posts-to-posts/admin/field-order.php Переглянути файл

@@ -0,0 +1,23 @@
1
+<?php
2
+
3
+class P2P_Field_Order implements P2P_Field {
4
+
5
+	protected $sort_key;
6
+
7
+	function __construct( $sort_key ) {
8
+		$this->sort_key = $sort_key;
9
+	}
10
+
11
+	function get_title() {
12
+		return '';
13
+	}
14
+
15
+	function render( $p2p_id, $_ ) {
16
+		return html( 'input', array(
17
+			'type' => 'hidden',
18
+			'name' => "p2p_order[$this->sort_key][]",
19
+			'value' => $p2p_id
20
+		) );
21
+	}
22
+}
23
+

+ 13
- 0
plugins/posts-to-posts/admin/field-title-attachment.php Переглянути файл

@@ -0,0 +1,13 @@
1
+<?php
2
+
3
+class P2P_Field_Title_Attachment extends P2P_Field_Title {
4
+
5
+	function get_data( $item ) {
6
+		$data = array(
7
+			'title-attr' => $item->get_object()->post_title,
8
+		);
9
+
10
+		return $data;
11
+	}
12
+}
13
+

+ 22
- 0
plugins/posts-to-posts/admin/field-title-post.php Переглянути файл

@@ -0,0 +1,22 @@
1
+<?php
2
+
3
+class P2P_Field_Title_Post extends P2P_Field_Title {
4
+
5
+	function get_data( $item ) {
6
+		$data = array(
7
+			'title-attr' => $item->get_permalink()
8
+		);
9
+
10
+		$post = $item->get_object();
11
+
12
+		if ( 'publish' != $post->post_status ) {
13
+			$status_obj = get_post_status_object( $post->post_status );
14
+			if ( $status_obj ) {
15
+				$data['status']['text'] = $status_obj->label;
16
+			}
17
+		}
18
+
19
+		return $data;
20
+	}
21
+}
22
+

+ 11
- 0
plugins/posts-to-posts/admin/field-title-user.php Переглянути файл

@@ -0,0 +1,11 @@
1
+<?php
2
+
3
+class P2P_Field_Title_User extends P2P_Field_Title {
4
+
5
+	function get_data( $user ) {
6
+		return array(
7
+			'title-attr' => '',
8
+		);
9
+	}
10
+}
11
+

+ 26
- 0
plugins/posts-to-posts/admin/field-title.php Переглянути файл

@@ -0,0 +1,26 @@
1
+<?php
2
+
3
+abstract class P2P_Field_Title implements P2P_Field {
4
+
5
+	protected $title;
6
+
7
+	function __construct( $title = '' ) {
8
+		$this->title = $title;
9
+	}
10
+
11
+	function get_title() {
12
+		return $this->title;
13
+	}
14
+
15
+	function render( $p2p_id, $item ) {
16
+		$data = array_merge( $this->get_data( $item ), array(
17
+			'title' => $item->title,
18
+			'url'   => $item->get_editlink(),
19
+		) );
20
+
21
+		return P2P_Mustache::render( 'column-title', $data );
22
+	}
23
+
24
+	abstract function get_data( $item );
25
+}
26
+

+ 10
- 0
plugins/posts-to-posts/admin/field.php Переглянути файл

@@ -0,0 +1,10 @@
1
+<?php
2
+
3
+/**
4
+ * A P2P admin metabox is composed of several "fields".
5
+ */
6
+interface P2P_Field {
7
+	function get_title();
8
+	function render( $p2p_id, $item );
9
+}
10
+

BIN
plugins/posts-to-posts/admin/images/minus.png Переглянути файл


BIN
plugins/posts-to-posts/admin/images/plus.png Переглянути файл


BIN
plugins/posts-to-posts/admin/images/sort.png Переглянути файл


+ 610
- 0
plugins/posts-to-posts/admin/mustache.js Переглянути файл

@@ -0,0 +1,610 @@
1
+/*!
2
+ * mustache.js - Logic-less {{mustache}} templates with JavaScript
3
+ * http://github.com/janl/mustache.js
4
+ */
5
+
6
+/*global define: false*/
7
+
8
+(function (root, factory) {
9
+  if (typeof exports === "object" && exports) {
10
+    module.exports = factory; // CommonJS
11
+  } else if (typeof define === "function" && define.amd) {
12
+    define(factory); // AMD
13
+  } else {
14
+    root.Mustache = factory; // <script>
15
+  }
16
+}(this, (function () {
17
+
18
+  var exports = {};
19
+
20
+  exports.name = "mustache.js";
21
+  exports.version = "0.7.2";
22
+  exports.tags = ["{{", "}}"];
23
+
24
+  exports.Scanner = Scanner;
25
+  exports.Context = Context;
26
+  exports.Writer = Writer;
27
+
28
+  var whiteRe = /\s*/;
29
+  var spaceRe = /\s+/;
30
+  var nonSpaceRe = /\S/;
31
+  var eqRe = /\s*=/;
32
+  var curlyRe = /\s*\}/;
33
+  var tagRe = /#|\^|\/|>|\{|&|=|!/;
34
+
35
+  // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
36
+  // See https://github.com/janl/mustache.js/issues/189
37
+  function testRe(re, string) {
38
+    return RegExp.prototype.test.call(re, string);
39
+  }
40
+
41
+  function isWhitespace(string) {
42
+    return !testRe(nonSpaceRe, string);
43
+  }
44
+
45
+  var isArray = Array.isArray || function (obj) {
46
+    return Object.prototype.toString.call(obj) === "[object Array]";
47
+  };
48
+
49
+  function escapeRe(string) {
50
+    return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
51
+  }
52
+
53
+  var entityMap = {
54
+    "&": "&amp;",
55
+    "<": "&lt;",
56
+    ">": "&gt;",
57
+    '"': '&quot;',
58
+    "'": '&#39;',
59
+    "/": '&#x2F;'
60
+  };
61
+
62
+  function escapeHtml(string) {
63
+    return String(string).replace(/[&<>"'\/]/g, function (s) {
64
+      return entityMap[s];
65
+    });
66
+  }
67
+
68
+  // Export the escaping function so that the user may override it.
69
+  // See https://github.com/janl/mustache.js/issues/244
70
+  exports.escape = escapeHtml;
71
+
72
+  function Scanner(string) {
73
+    this.string = string;
74
+    this.tail = string;
75
+    this.pos = 0;
76
+  }
77
+
78
+  /**
79
+   * Returns `true` if the tail is empty (end of string).
80
+   */
81
+  Scanner.prototype.eos = function () {
82
+    return this.tail === "";
83
+  };
84
+
85
+  /**
86
+   * Tries to match the given regular expression at the current position.
87
+   * Returns the matched text if it can match, the empty string otherwise.
88
+   */
89
+  Scanner.prototype.scan = function (re) {
90
+    var match = this.tail.match(re);
91
+
92
+    if (match && match.index === 0) {
93
+      this.tail = this.tail.substring(match[0].length);
94
+      this.pos += match[0].length;
95
+      return match[0];
96
+    }
97
+
98
+    return "";
99
+  };
100
+
101
+  /**
102
+   * Skips all text until the given regular expression can be matched. Returns
103
+   * the skipped string, which is the entire tail if no match can be made.
104
+   */
105
+  Scanner.prototype.scanUntil = function (re) {
106
+    var match, pos = this.tail.search(re);
107
+
108
+    switch (pos) {
109
+    case -1:
110
+      match = this.tail;
111
+      this.pos += this.tail.length;
112
+      this.tail = "";
113
+      break;
114
+    case 0:
115
+      match = "";
116
+      break;
117
+    default:
118
+      match = this.tail.substring(0, pos);
119
+      this.tail = this.tail.substring(pos);
120
+      this.pos += pos;
121
+    }
122
+
123
+    return match;
124
+  };
125
+
126
+  function Context(view, parent) {
127
+    this.view = view;
128
+    this.parent = parent;
129
+    this.clearCache();
130
+  }
131
+
132
+  Context.make = function (view) {
133
+    return (view instanceof Context) ? view : new Context(view);
134
+  };
135
+
136
+  Context.prototype.clearCache = function () {
137
+    this._cache = {};
138
+  };
139
+
140
+  Context.prototype.push = function (view) {
141
+    return new Context(view, this);
142
+  };
143
+
144
+  Context.prototype.lookup = function (name) {
145
+    var value = this._cache[name];
146
+
147
+    if (!value) {
148
+      if (name === ".") {
149
+        value = this.view;
150
+      } else {
151
+        var context = this;
152
+
153
+        while (context) {
154
+          if (name.indexOf(".") > 0) {
155
+            var names = name.split("."), i = 0;
156
+
157
+            value = context.view;
158
+
159
+            while (value && i < names.length) {
160
+              value = value[names[i++]];
161
+            }
162
+          } else {
163
+            value = context.view[name];
164
+          }
165
+
166
+          if (value != null) {
167
+            break;
168
+          }
169
+
170
+          context = context.parent;
171
+        }
172
+      }
173
+
174
+      this._cache[name] = value;
175
+    }
176
+
177
+    if (typeof value === "function") {
178
+      value = value.call(this.view);
179
+    }
180
+
181
+    return value;
182
+  };
183
+
184
+  function Writer() {
185
+    this.clearCache();
186
+  }
187
+
188
+  Writer.prototype.clearCache = function () {
189
+    this._cache = {};
190
+    this._partialCache = {};
191
+  };
192
+
193
+  Writer.prototype.compile = function (template, tags) {
194
+    var fn = this._cache[template];
195
+
196
+    if (!fn) {
197
+      var tokens = exports.parse(template, tags);
198
+      fn = this._cache[template] = this.compileTokens(tokens, template);
199
+    }
200
+
201
+    return fn;
202
+  };
203
+
204
+  Writer.prototype.compilePartial = function (name, template, tags) {
205
+    var fn = this.compile(template, tags);
206
+    this._partialCache[name] = fn;
207
+    return fn;
208
+  };
209
+
210
+  Writer.prototype.compileTokens = function (tokens, template) {
211
+    var fn = compileTokens(tokens);
212
+    var self = this;
213
+
214
+    return function (view, partials) {
215
+      if (partials) {
216
+        if (typeof partials === "function") {
217
+          self._loadPartial = partials;
218
+        } else {
219
+          for (var name in partials) {
220
+            self.compilePartial(name, partials[name]);
221
+          }
222
+        }
223
+      }
224
+
225
+      return fn(self, Context.make(view), template);
226
+    };
227
+  };
228
+
229
+  Writer.prototype.render = function (template, view, partials) {
230
+    return this.compile(template)(view, partials);
231
+  };
232
+
233
+  Writer.prototype._section = function (name, context, text, callback) {
234
+    var value = context.lookup(name);
235
+
236
+    switch (typeof value) {
237
+    case "object":
238
+      if (isArray(value)) {
239
+        var buffer = "";
240
+
241
+        for (var i = 0, len = value.length; i < len; ++i) {
242
+          buffer += callback(this, context.push(value[i]));
243
+        }
244
+
245
+        return buffer;
246
+      }
247
+
248
+      return value ? callback(this, context.push(value)) : "";
249
+    case "function":
250
+      var self = this;
251
+      var scopedRender = function (template) {
252
+        return self.render(template, context);
253
+      };
254
+
255
+      var result = value.call(context.view, text, scopedRender);
256
+      return result != null ? result : "";
257
+    default:
258
+      if (value) {
259
+        return callback(this, context);
260
+      }
261
+    }
262
+
263
+    return "";
264
+  };
265
+
266
+  Writer.prototype._inverted = function (name, context, callback) {
267
+    var value = context.lookup(name);
268
+
269
+    // Use JavaScript's definition of falsy. Include empty arrays.
270
+    // See https://github.com/janl/mustache.js/issues/186
271
+    if (!value || (isArray(value) && value.length === 0)) {
272
+      return callback(this, context);
273
+    }
274
+
275
+    return "";
276
+  };
277
+
278
+  Writer.prototype._partial = function (name, context) {
279
+    if (!(name in this._partialCache) && this._loadPartial) {
280
+      this.compilePartial(name, this._loadPartial(name));
281
+    }
282
+
283
+    var fn = this._partialCache[name];
284
+
285
+    return fn ? fn(context) : "";
286
+  };
287
+
288
+  Writer.prototype._name = function (name, context) {
289
+    var value = context.lookup(name);
290
+
291
+    if (typeof value === "function") {
292
+      value = value.call(context.view);
293
+    }
294
+
295
+    return (value == null) ? "" : String(value);
296
+  };
297
+
298
+  Writer.prototype._escaped = function (name, context) {
299
+    return exports.escape(this._name(name, context));
300
+  };
301
+
302
+  /**
303
+   * Low-level function that compiles the given `tokens` into a function
304
+   * that accepts three arguments: a Writer, a Context, and the template.
305
+   */
306
+  function compileTokens(tokens) {
307
+    var subRenders = {};
308
+
309
+    function subRender(i, tokens, template) {
310
+      if (!subRenders[i]) {
311
+        var fn = compileTokens(tokens);
312
+        subRenders[i] = function (writer, context) {
313
+          return fn(writer, context, template);
314
+        };
315
+      }
316
+
317
+      return subRenders[i];
318
+    }
319
+
320
+    return function (writer, context, template) {
321
+      var buffer = "";
322
+      var token, sectionText;
323
+
324
+      for (var i = 0, len = tokens.length; i < len; ++i) {
325
+        token = tokens[i];
326
+
327
+        switch (token[0]) {
328
+        case "#":
329
+          sectionText = template.slice(token[3], token[5]);
330
+          buffer += writer._section(token[1], context, sectionText, subRender(i, token[4], template));
331
+          break;
332
+        case "^":
333
+          buffer += writer._inverted(token[1], context, subRender(i, token[4], template));
334
+          break;
335
+        case ">":
336
+          buffer += writer._partial(token[1], context);
337
+          break;
338
+        case "&":
339
+          buffer += writer._name(token[1], context);
340
+          break;
341
+        case "name":
342
+          buffer += writer._escaped(token[1], context);
343
+          break;
344
+        case "text":
345
+          buffer += token[1];
346
+          break;
347
+        }
348
+      }
349
+
350
+      return buffer;
351
+    };
352
+  }
353
+
354
+  /**
355
+   * Forms the given array of `tokens` into a nested tree structure where
356
+   * tokens that represent a section have two additional items: 1) an array of
357
+   * all tokens that appear in that section and 2) the index in the original
358
+   * template that represents the end of that section.
359
+   */
360
+  function nestTokens(tokens) {
361
+    var tree = [];
362
+    var collector = tree;
363
+    var sections = [];
364
+
365
+    var token;
366
+    for (var i = 0, len = tokens.length; i < len; ++i) {
367
+      token = tokens[i];
368
+      switch (token[0]) {
369
+      case '#':
370
+      case '^':
371
+        sections.push(token);
372
+        collector.push(token);
373
+        collector = token[4] = [];
374
+        break;
375
+      case '/':
376
+        var section = sections.pop();
377
+        section[5] = token[2];
378
+        collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;
379
+        break;
380
+      default:
381
+        collector.push(token);
382
+      }
383
+    }
384
+
385
+    return tree;
386
+  }
387
+
388
+  /**
389
+   * Combines the values of consecutive text tokens in the given `tokens` array
390
+   * to a single token.
391
+   */
392
+  function squashTokens(tokens) {
393
+    var squashedTokens = [];
394
+
395
+    var token, lastToken;
396
+    for (var i = 0, len = tokens.length; i < len; ++i) {
397
+      token = tokens[i];
398
+      if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
399
+        lastToken[1] += token[1];
400
+        lastToken[3] = token[3];
401
+      } else {
402
+        lastToken = token;
403
+        squashedTokens.push(token);
404
+      }
405
+    }
406
+
407
+    return squashedTokens;
408
+  }
409
+
410
+  function escapeTags(tags) {
411
+    return [
412
+      new RegExp(escapeRe(tags[0]) + "\\s*"),
413
+      new RegExp("\\s*" + escapeRe(tags[1]))
414
+    ];
415
+  }
416
+
417
+  /**
418
+   * Breaks up the given `template` string into a tree of token objects. If
419
+   * `tags` is given here it must be an array with two string values: the
420
+   * opening and closing tags used in the template (e.g. ["<%", "%>"]). Of
421
+   * course, the default is to use mustaches (i.e. Mustache.tags).
422
+   */
423
+  exports.parse = function (template, tags) {
424
+    template = template || '';
425
+    tags = tags || exports.tags;
426
+
427
+    if (typeof tags === 'string') tags = tags.split(spaceRe);
428
+    if (tags.length !== 2) {
429
+      throw new Error('Invalid tags: ' + tags.join(', '));
430
+    }
431
+
432
+    var tagRes = escapeTags(tags);
433
+    var scanner = new Scanner(template);
434
+
435
+    var sections = [];     // Stack to hold section tokens
436
+    var tokens = [];       // Buffer to hold the tokens
437
+    var spaces = [];       // Indices of whitespace tokens on the current line
438
+    var hasTag = false;    // Is there a {{tag}} on the current line?
439
+    var nonSpace = false;  // Is there a non-space char on the current line?
440
+
441
+    // Strips all whitespace tokens array for the current line
442
+    // if there was a {{#tag}} on it and otherwise only space.
443
+    function stripSpace() {
444
+      if (hasTag && !nonSpace) {
445
+        while (spaces.length) {
446
+          tokens.splice(spaces.pop(), 1);
447
+        }
448
+      } else {
449
+        spaces = [];
450
+      }
451
+
452
+      hasTag = false;
453
+      nonSpace = false;
454
+    }
455
+
456
+    var start, type, value, chr;
457
+    while (!scanner.eos()) {
458
+      start = scanner.pos;
459
+      value = scanner.scanUntil(tagRes[0]);
460
+
461
+      if (value) {
462
+        for (var i = 0, len = value.length; i < len; ++i) {
463
+          chr = value.charAt(i);
464
+
465
+          if (isWhitespace(chr)) {
466
+            spaces.push(tokens.length);
467
+          } else {
468
+            nonSpace = true;
469
+          }
470
+
471
+          tokens.push(["text", chr, start, start + 1]);
472
+          start += 1;
473
+
474
+          if (chr === "\n") {
475
+            stripSpace(); // Check for whitespace on the current line.
476
+          }
477
+        }
478
+      }
479
+
480
+      start = scanner.pos;
481
+
482
+      // Match the opening tag.
483
+      if (!scanner.scan(tagRes[0])) {
484
+        break;
485
+      }
486
+
487
+      hasTag = true;
488
+      type = scanner.scan(tagRe) || "name";
489
+
490
+      // Skip any whitespace between tag and value.
491
+      scanner.scan(whiteRe);
492
+
493
+      // Extract the tag value.
494
+      if (type === "=") {
495
+        value = scanner.scanUntil(eqRe);
496
+        scanner.scan(eqRe);
497
+        scanner.scanUntil(tagRes[1]);
498
+      } else if (type === "{") {
499
+        var closeRe = new RegExp("\\s*" + escapeRe("}" + tags[1]));
500
+        value = scanner.scanUntil(closeRe);
501
+        scanner.scan(curlyRe);
502
+        scanner.scanUntil(tagRes[1]);
503
+        type = "&";
504
+      } else {
505
+        value = scanner.scanUntil(tagRes[1]);
506
+      }
507
+
508
+      // Match the closing tag.
509
+      if (!scanner.scan(tagRes[1])) {
510
+        throw new Error('Unclosed tag at ' + scanner.pos);
511
+      }
512
+
513
+      // Check section nesting.
514
+      if (type === '/') {
515
+        if (sections.length === 0) {
516
+          throw new Error('Unopened section "' + value + '" at ' + start);
517
+        }
518
+
519
+        var section = sections.pop();
520
+
521
+        if (section[1] !== value) {
522
+          throw new Error('Unclosed section "' + section[1] + '" at ' + start);
523
+        }
524
+      }
525
+
526
+      var token = [type, value, start, scanner.pos];
527
+      tokens.push(token);
528
+
529
+      if (type === '#' || type === '^') {
530
+        sections.push(token);
531
+      } else if (type === "name" || type === "{" || type === "&") {
532
+        nonSpace = true;
533
+      } else if (type === "=") {
534
+        // Set the tags for the next time around.
535
+        tags = value.split(spaceRe);
536
+
537
+        if (tags.length !== 2) {
538
+          throw new Error('Invalid tags at ' + start + ': ' + tags.join(', '));
539
+        }
540
+
541
+        tagRes = escapeTags(tags);
542
+      }
543
+    }
544
+
545
+    // Make sure there are no open sections when we're done.
546
+    var section = sections.pop();
547
+    if (section) {
548
+      throw new Error('Unclosed section "' + section[1] + '" at ' + scanner.pos);
549
+    }
550
+
551
+    return nestTokens(squashTokens(tokens));
552
+  };
553
+
554
+  // The high-level clearCache, compile, compilePartial, and render functions
555
+  // use this default writer.
556
+  var _writer = new Writer();
557
+
558
+  /**
559
+   * Clears all cached templates and partials in the default writer.
560
+   */
561
+  exports.clearCache = function () {
562
+    return _writer.clearCache();
563
+  };
564
+
565
+  /**
566
+   * Compiles the given `template` to a reusable function using the default
567
+   * writer.
568
+   */
569
+  exports.compile = function (template, tags) {
570
+    return _writer.compile(template, tags);
571
+  };
572
+
573
+  /**
574
+   * Compiles the partial with the given `name` and `template` to a reusable
575
+   * function using the default writer.
576
+   */
577
+  exports.compilePartial = function (name, template, tags) {
578
+    return _writer.compilePartial(name, template, tags);
579
+  };
580
+
581
+  /**
582
+   * Compiles the given array of tokens (the output of a parse) to a reusable
583
+   * function using the default writer.
584
+   */
585
+  exports.compileTokens = function (tokens, template) {
586
+    return _writer.compileTokens(tokens, template);
587
+  };
588
+
589
+  /**
590
+   * Renders the `template` with the given `view` and `partials` using the
591
+   * default writer.
592
+   */
593
+  exports.render = function (template, view, partials) {
594
+    return _writer.render(template, view, partials);
595
+  };
596
+
597
+  // This is here for backwards compatibility with 0.4.x.
598
+  exports.to_html = function (template, view, partials, send) {
599
+    var result = exports.render(template, view, partials);
600
+
601
+    if (typeof send === "function") {
602
+      send(result);
603
+    } else {
604
+      return result;
605
+    }
606
+  };
607
+
608
+  return exports;
609
+
610
+}())));

+ 24
- 0
plugins/posts-to-posts/admin/mustache.php Переглянути файл

@@ -0,0 +1,24 @@
1
+<?php
2
+
3
+/**
4
+ * @internal
5
+ */
6
+abstract class P2P_Mustache {
7
+
8
+	private static $mustache;
9
+
10
+	public static function init() {
11
+		$loader = new Mustache_Loader_FilesystemLoader(
12
+			dirname(__FILE__) . '/templates', array( 'extension' => 'html' ) );
13
+
14
+		self::$mustache = new Mustache_Engine( array(
15
+			'loader' => $loader,
16
+			'partials_loader' => $loader
17
+		) );
18
+	}
19
+
20
+	public static function render( $template, $data ) {
21
+		return self::$mustache->render( $template, $data );
22
+	}
23
+}
24
+

+ 43
- 0
plugins/posts-to-posts/admin/templates/box.html Переглянути файл

@@ -0,0 +1,43 @@
1
+<div class="p2p-box" {{attributes}}>
2
+	<p class="help">{{help}}</p>
3
+
4
+	{{#connections}}
5
+	<table class="p2p-connections" {{{hide}}}>
6
+		<thead>
7
+			<tr>
8
+				{{#thead}}
9
+				<th class="p2p-col-{{column}}">{{{title}}}</th>
10
+				{{/thead}}
11
+			</tr>
12
+		</thead>
13
+
14
+		<tbody>
15
+			{{#tbody}}
16
+			{{>table-row}}
17
+			{{/tbody}}
18
+		</tbody>
19
+	</table>
20
+	{{/connections}}
21
+
22
+	{{#create-connections}}
23
+	<div class="p2p-create-connections" {{{hide}}}>
24
+		<p class="p2p-toggle-tabs"><a href="#">+ {{{label}}}</a></p>
25
+
26
+		<div class="p2p-create-connections-tabs" style="display: none">
27
+			{{#show-tab-headers}}
28
+			<ul class="wp-tab-bar clearfix">
29
+				{{#tabs}}
30
+				<li {{#is-active}}class="wp-tab-active"{{/is-active}} data-ref=".p2p-tab-{{tab-id}}"><a href="#">{{{tab-title}}}</a></li>
31
+				{{/tabs}}
32
+			</ul>
33
+			{{/show-tab-headers}}
34
+
35
+			{{#tabs}}
36
+			<div class="p2p-tab-{{tab-id}} tabs-panel">
37
+				{{{tab-content}}}
38
+			</div>
39
+			{{/tabs}}
40
+		</div>
41
+	</div>
42
+	{{/create-connections}}
43
+</div>

+ 4
- 0
plugins/posts-to-posts/admin/templates/column-create.html Переглянути файл

@@ -0,0 +1,4 @@
1
+<div data-item-id="{{item-id}}" title="{{{title-attr}}}">
2
+	<span class="p2p-icon"></span>
3
+	{{{title}}}{{#status}} - <span class="post-state">{{text}}</span>{{/status}}
4
+</div>

+ 1
- 0
plugins/posts-to-posts/admin/templates/column-delete-all.html Переглянути файл

@@ -0,0 +1 @@
1
+<span class="p2p-icon" title="{{{title}}}"></span>

+ 2
- 0
plugins/posts-to-posts/admin/templates/column-delete.html Переглянути файл

@@ -0,0 +1,2 @@
1
+<span class="p2p-icon" title="{{{title}}}"></span>
2
+<input type="hidden" name="p2p_connections[]" value="{{p2p_id}}" />

+ 1
- 0
plugins/posts-to-posts/admin/templates/column-title.html Переглянути файл

@@ -0,0 +1 @@
1
+<a href="{{{url}}}" title="{{title-attr}}">{{{title}}}</a>{{#status}} - <span class="post-state">{{text}}</span>{{/status}}

+ 8
- 0
plugins/posts-to-posts/admin/templates/connection-types-form.html Переглянути файл

@@ -0,0 +1,8 @@
1
+<input type="hidden" name="old_p2p_type" value="{{old_p2p_type}}" />
2
+<select name="new_p2p_type">
3
+	<option></option>
4
+	{{#options}}
5
+	<option>{{.}}</option>
6
+	{{/options}}
7
+</select>
8
+<input class="button button-small" type="submit" name="p2p_convert" value="{{{button_text}}}" />

+ 24
- 0
plugins/posts-to-posts/admin/templates/connection-types.html Переглянути файл

@@ -0,0 +1,24 @@
1
+{{#has-rows}}
2
+<table class="widefat">
3
+	<thead>
4
+		<tr>
5
+			{{#columns}}
6
+			<th>{{.}}</th>
7
+			{{/columns}}
8
+		</tr>
9
+	</thead>
10
+	<tbody>
11
+		{{#rows}}
12
+		<tr class="{{class}}">
13
+			<td>{{p2p_type}}</td>
14
+			<td>{{{desc}}}</td>
15
+			<td>{{count}}</td>
16
+		</tr>
17
+		{{/rows}}
18
+	</tbody>
19
+</table>
20
+{{/has-rows}}
21
+{{^has-rows}}
22
+	<p>{{{no-rows}}}</p>
23
+	<p>{{{no-rows2}}}</p>
24
+{{/has-rows}}

+ 2
- 0
plugins/posts-to-posts/admin/templates/tab-create-post.html Переглянути файл

@@ -0,0 +1,2 @@
1
+<input type="text" name="p2p_new_title" autocomplete="off" />
2
+<button class="button">{{{title}}}</button>

+ 19
- 0
plugins/posts-to-posts/admin/templates/tab-list.html Переглянути файл

@@ -0,0 +1,19 @@
1
+<table class="p2p-results">
2
+	<tbody>
3
+		{{#rows}}
4
+			{{>table-row}}
5
+		{{/rows}}
6
+	</tbody>
7
+</table>
8
+
9
+{{#navigation}}
10
+<div class="p2p-navigation">
11
+	<div class="p2p-prev button {{prev-inactive}}" title="{{prev-label}}">&lsaquo;</div>
12
+	<div>
13
+		<span class="p2p-current">{{current-page}}</span>
14
+		{{of-label}}
15
+		<span class="p2p-total" data-num="{{total-pages-raw}}">{{total-pages}}</span>
16
+	</div>
17
+	<div class="p2p-next button {{next-inactive}}" title="{{next-label}}">&rsaquo;</div>
18
+</div>
19
+{{/navigation}}

+ 5
- 0
plugins/posts-to-posts/admin/templates/tab-search.html Переглянути файл

@@ -0,0 +1,5 @@
1
+<div class="p2p-search">
2
+	<input type="text" name="p2p_search" autocomplete="off" placeholder="{{{placeholder}}}" />
3
+</div>
4
+
5
+{{{candidates}}}

+ 5
- 0
plugins/posts-to-posts/admin/templates/table-row.html Переглянути файл

@@ -0,0 +1,5 @@
1
+<tr>
2
+	{{#columns}}
3
+	<td class="p2p-col-{{column}}">{{{content}}}</td>
4
+	{{/columns}}
5
+</tr>

+ 135
- 0
plugins/posts-to-posts/admin/tools-page.php Переглянути файл

@@ -0,0 +1,135 @@
1
+<?php
2
+
3
+class P2P_Tools_Page extends scbAdminPage {
4
+
5
+	function setup() {
6
+		$this->args = array(
7
+			'page_title' => __( 'Connection Types', P2P_TEXTDOMAIN ),
8
+			'page_slug' => 'connection-types',
9
+			'parent' => 'tools.php'
10
+		);
11
+
12
+		add_action( 'admin_notices', array( $this, 'maybe_install' ) );
13
+	}
14
+
15
+	function maybe_install() {
16
+		if ( !current_user_can( 'manage_options' ) )
17
+			return;
18
+
19
+		$current_ver = get_option( 'p2p_storage' );
20
+
21
+		if ( $current_ver == P2P_Storage::$version )
22
+			return;
23
+
24
+		P2P_Storage::install();
25
+
26
+		update_option( 'p2p_storage', P2P_Storage::$version );
27
+	}
28
+
29
+	function form_handler() {
30
+		if ( empty( $_POST['p2p_convert'] ) )
31
+			return false;
32
+
33
+		check_admin_referer( $this->nonce );
34
+
35
+		global $wpdb;
36
+
37
+		$old_p2p_type = $_POST['old_p2p_type'];
38
+		$new_p2p_type = $_POST['new_p2p_type'];
39
+
40
+		if ( !p2p_type( $new_p2p_type ) ) {
41
+			$this->admin_msg( sprintf( __( '<em>%s</em> is not a registered connection type.', P2P_TEXTDOMAIN ), esc_html( $new_p2p_type ) ) );
42
+			return;
43
+		}
44
+
45
+		$count = $wpdb->update( $wpdb->p2p,
46
+			array( 'p2p_type' => $new_p2p_type ),
47
+			array( 'p2p_type' => $old_p2p_type )
48
+		);
49
+
50
+		$this->admin_msg( sprintf( __( 'Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>.', P2P_TEXTDOMAIN ),
51
+			number_format_i18n( $count ),
52
+			esc_html( $old_p2p_type ),
53
+			esc_html( $new_p2p_type )
54
+		) );
55
+	}
56
+
57
+	function page_head() {
58
+		wp_enqueue_style( 'p2p-tools', plugins_url( 'tools.css', __FILE__ ), array(), P2P_PLUGIN_VERSION );
59
+	}
60
+
61
+	function page_content() {
62
+		$data = array(
63
+			'columns' => array(
64
+				__( 'Name', P2P_TEXTDOMAIN ),
65
+				__( 'Information', P2P_TEXTDOMAIN ),
66
+				__( 'Connections', P2P_TEXTDOMAIN ),
67
+			)
68
+		);
69
+
70
+		$connection_counts = $this->get_connection_counts();
71
+
72
+		if ( empty( $connection_counts ) ) {
73
+			$data['has-rows'] = false;
74
+			$data['no-rows'] = __( 'No connection types registered.', P2P_TEXTDOMAIN );
75
+			$data['no-rows2'] = sprintf(
76
+				__( 'To register a connection type, see <a href="%s">the wiki</a>.', P2P_TEXTDOMAIN ),
77
+				'https://github.com/scribu/wp-posts-to-posts/wiki/'
78
+			);
79
+		} else {
80
+			$data['has-rows'] = array(true);
81
+
82
+			foreach ( $connection_counts as $p2p_type => $count ) {
83
+				$row = array(
84
+					'p2p_type' => $p2p_type,
85
+					'count' => number_format_i18n( $count )
86
+				);
87
+
88
+				$ctype = p2p_type( $p2p_type );
89
+
90
+				if ( $ctype ) {
91
+					$row['desc'] = $ctype->get_desc();
92
+				} else {
93
+					$row['desc'] = __( 'Convert to registered connection type:', P2P_TEXTDOMAIN ) . scbForms::form_wrap( $this->get_dropdown( $p2p_type ), $this->nonce );
94
+					$row['class'] = 'error';
95
+				}
96
+
97
+				$data['rows'][] = $row;
98
+			}
99
+		}
100
+
101
+		echo P2P_Mustache::render( 'connection-types', $data );
102
+	}
103
+
104
+	private function get_connection_counts() {
105
+		global $wpdb;
106
+
107
+		$counts = $wpdb->get_results( "
108
+			SELECT p2p_type, COUNT(*) as count
109
+			FROM $wpdb->p2p
110
+			GROUP BY p2p_type
111
+		" );
112
+
113
+		$counts = scb_list_fold( $counts, 'p2p_type', 'count' );
114
+
115
+		foreach ( P2P_Connection_Type_Factory::get_all_instances() as $p2p_type => $ctype ) {
116
+			if ( !isset( $counts[ $p2p_type ] ) )
117
+				$counts[ $p2p_type ] = 0;
118
+		}
119
+
120
+		ksort( $counts );
121
+
122
+		return $counts;
123
+	}
124
+
125
+	private function get_dropdown( $p2p_type ) {
126
+		$data = array(
127
+			'old_p2p_type' => $p2p_type,
128
+			'options' => array_keys( P2P_Connection_Type_Factory::get_all_instances() ),
129
+			'button_text' => __( 'Go', P2P_TEXTDOMAIN )
130
+		);
131
+
132
+		return P2P_Mustache::render( 'connection-types-form', $data );
133
+	}
134
+}
135
+

+ 15
- 0
plugins/posts-to-posts/admin/tools.css Переглянути файл

@@ -0,0 +1,15 @@
1
+.widefat {
2
+	margin-top: 15px;
3
+}
4
+
5
+.widefat .error {
6
+	background-color: pink;
7
+}
8
+
9
+.widefat td form {
10
+	display: inline;
11
+}
12
+
13
+.widefat td {
14
+	vertical-align: middle;
15
+}

+ 109
- 0
plugins/posts-to-posts/command.php Переглянути файл

@@ -0,0 +1,109 @@
1
+<?php
2
+
3
+WP_CLI::add_command( 'p2p', 'P2P_CLI_Command' );
4
+
5
+class P2P_CLI_Command extends WP_CLI_Command {
6
+
7
+	/**
8
+	 * List registered connection types.
9
+	 *
10
+	 * @subcommand connection-types
11
+	 */
12
+	function connection_types() {
13
+		foreach ( P2P_Connection_Type_Factory::get_all_instances() as $p2p_type => $ctype ) {
14
+			WP_CLI::line( $p2p_type );
15
+		}
16
+	}
17
+
18
+	/**
19
+	 * Generate connections for a specific connection type.
20
+	 *
21
+	 * @subcommand generate-connections
22
+	 * @synopsis <connection-type> [--items]
23
+	 */
24
+	function generate_connections( $args, $assoc_args ) {
25
+		list( $connection_type ) = $args;
26
+
27
+		$ctype = p2p_type( $connection_type );
28
+		if ( !$ctype )
29
+			WP_CLI::error( "'$connection_type' is not a registered connection type." );
30
+
31
+		if ( isset( $assoc_args['items'] ) ) {
32
+			foreach ( _p2p_extract_post_types( $ctype->side ) as $ptype ) {
33
+				$assoc_args = array( 'post_type' => $ptype );
34
+
35
+				WP_CLI::launch( 'wp post generate' . \WP_CLI\Utils\assoc_args_to_str( $assoc_args ) );
36
+			}
37
+		}
38
+
39
+		$count = $this->_generate_c( $ctype );
40
+
41
+		WP_CLI::success( "Created $count connections." );
42
+	}
43
+
44
+	private function _generate_c( $ctype ) {
45
+		$extra_qv = array( 'p2p:per_page' => 10 );
46
+
47
+		$candidate = $ctype
48
+			->set_direction( 'from' )
49
+			->get_connectable( 'any', $extra_qv, 'abstract' );
50
+
51
+		$count = 0;
52
+
53
+		foreach ( $candidate->items as $from ) {
54
+			$eligible = $ctype->get_connectable( $from, array(
55
+				'p2p:per_page' => rand( 0, 5 )
56
+			), 'abstract' );
57
+
58
+			foreach ( $eligible->items as $to ) {
59
+				$r = $ctype->connect( $from, $to );
60
+
61
+				if ( is_wp_error( $r ) )
62
+					WP_CLI::warning( $r );
63
+				else
64
+					$count++;
65
+			}
66
+		}
67
+
68
+		return $count;
69
+	}
70
+
71
+	/**
72
+	 * Set up the example connections.
73
+	 *
74
+	 * @subcommand setup-example
75
+	 */
76
+	function setup_example() {
77
+		$ctype = p2p_type( 'actor_movie' );
78
+
79
+		$data = array(
80
+			'Nicholas Cage' => array( 'Lord Of War', 'Adaptation' ),
81
+			'Jude Law' => array( 'Sherlock Holmes' ),
82
+			'Brad Pitt' => array( '7 Years In Tibet', 'Fight Club' ),
83
+			'Natalie Portman' => array( 'Black Swan', 'Thor' ),
84
+			'Matt Damon' => array( 'The Talented Mr. Ripley' ),
85
+			'Charlize Theron' => array(),
86
+		);
87
+
88
+		foreach ( $data as $actor_name => $movies ) {
89
+			$actor = self::titled_post( 'actor',  $actor_name );
90
+
91
+			foreach ( $movies as $movie_title ) {
92
+				$movie = self::titled_post( 'movie', $movie_title );
93
+
94
+				$ctype->connect( $actor, $movie );
95
+			}
96
+		}
97
+
98
+		WP_CLI::success( "Set up the actors and movies example." );
99
+	}
100
+
101
+	private static function titled_post( $type, $title ) {
102
+		return wp_insert_post( array(
103
+			'post_type' => $type,
104
+			'post_title' => $title,
105
+			'post_status' => 'publish'
106
+		) );
107
+	}
108
+}
109
+

+ 18
- 0
plugins/posts-to-posts/composer.json Переглянути файл

@@ -0,0 +1,18 @@
1
+{
2
+    "name": "scribu/posts-to-posts",
3
+    "type": "wordpress-plugin",
4
+    "homepage": "http://wordpress.org/plugins/posts-to-posts",
5
+    "license": "GPL-2.0+",
6
+    "minimum-stability": "dev",
7
+    "require": {
8
+        "composer/installers": "~1.0",
9
+        "scribu/lib-posts-to-posts": "dev-master",
10
+        "mustache/mustache": "~2.6"
11
+    },
12
+    "repositories": [
13
+        {
14
+            "type": "vcs",
15
+            "url": "https://github.com/scribu/wp-lib-posts-to-posts"
16
+        }
17
+    ]
18
+}

+ 40
- 0
plugins/posts-to-posts/debug-utils.php Переглянути файл

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+// Tools for testing and debugging P2P
4
+
5
+add_action( 'p2p_registered_connection_type', '_p2p_register_missing_post_types' );
6
+
7
+function _p2p_register_missing_post_types( $ctype ) {
8
+	foreach ( _p2p_extract_post_types( $ctype->side ) as $ptype ) {
9
+		if ( !post_type_exists( $ptype ) ) {
10
+			_p2p_generate_post_type( $ptype );
11
+		}
12
+	}
13
+}
14
+
15
+function _p2p_generate_post_type( $slug ) {
16
+	register_post_type( $slug, array(
17
+		'labels' => array(
18
+			'name' => ucfirst( $slug ),
19
+			'singular_name' => ucfirst( $slug ),
20
+		),
21
+		'public' => true,
22
+		'supports' => array( 'title' )
23
+	) );
24
+}
25
+
26
+function _p2p_walk( $posts, $level = 0 ) {
27
+	if ( 0 == $level )
28
+		echo "<pre>\n";
29
+
30
+	foreach ( $posts as $post ) {
31
+		echo str_repeat( "\t", $level ) . "$post->ID: $post->post_title\n";
32
+
33
+		if ( isset( $post->connected ) )
34
+			_p2p_walk( $post->connected, $level+1 );
35
+	}
36
+
37
+	if ( 0 == $level )
38
+		echo "</pre>\n";
39
+}
40
+

BIN
plugins/posts-to-posts/lang/posts-to-posts-da_DK.mo Переглянути файл


+ 156
- 0
plugins/posts-to-posts/lang/posts-to-posts-da_DK.po Переглянути файл

@@ -0,0 +1,156 @@
1
+# Copyright (C) 2013 
2
+# This file is distributed under the same license as the  package.
3
+msgid ""
4
+msgstr ""
5
+"Project-Id-Version: Posts 2 Posts\n"
6
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
7
+"POT-Creation-Date: 2013-02-17 08:06:11+00:00\n"
8
+"MIME-Version: 1.0\n"
9
+"Content-Type: text/plain; charset=UTF-8\n"
10
+"Content-Transfer-Encoding: 8bit\n"
11
+"PO-Revision-Date: 2014-10-07 15:48+0100\n"
12
+"Last-Translator: Phh <phh@peytz.dk>\n"
13
+"Language-Team: \n"
14
+"X-Generator: Poedit 1.6.9\n"
15
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+"Language: da\n"
17
+
18
+#: admin/box.php:45
19
+msgid "Are you sure you want to delete all connections?"
20
+msgstr "Er du sikker på du vil slette alle forbindelser?"
21
+
22
+#: admin/box.php:136
23
+msgid "Search"
24
+msgstr "Søg"
25
+
26
+#: admin/box.php:213
27
+msgid "previous"
28
+msgstr "forrige"
29
+
30
+#: admin/box.php:214
31
+msgid "next"
32
+msgstr "næste"
33
+
34
+#: admin/box.php:215
35
+msgid "of"
36
+msgstr "af"
37
+
38
+#: admin/dropdown-user.php:32
39
+msgid "Filter"
40
+msgstr "Filter"
41
+
42
+#: admin/factory.php:88
43
+msgid " (from)"
44
+msgstr " (fra)"
45
+
46
+#: admin/factory.php:89
47
+msgid " (to)"
48
+msgstr " (til)"
49
+
50
+#: admin/field-delete.php:7
51
+msgid "Delete all connections"
52
+msgstr "Slet alle forbindelser"
53
+
54
+#: admin/field-delete.php:16
55
+msgid "Delete connection"
56
+msgstr "Slet forbindelse"
57
+
58
+#: admin/tools-page.php:7
59
+msgid "Connection Types"
60
+msgstr "Forbindelsestyper"
61
+
62
+#: admin/tools-page.php:41
63
+msgid "<em>%s</em> is not a registered connection type."
64
+msgstr "<em>%s</em> er ikke en registreret forbindelsestype."
65
+
66
+#: admin/tools-page.php:50
67
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
68
+msgstr "Konverterede %1$s forbindelser from <em>%2$s</em> til <em>%3$s</em>."
69
+
70
+#: admin/tools-page.php:64
71
+msgid "Name"
72
+msgstr "Navn"
73
+
74
+#: admin/tools-page.php:65
75
+msgid "Information"
76
+msgstr "Information"
77
+
78
+#: admin/tools-page.php:66
79
+msgid "Connections"
80
+msgstr "Forbindelser"
81
+
82
+#: admin/tools-page.php:74
83
+msgid "No connection types registered."
84
+msgstr "Ingen forbindelsestyper registreret."
85
+
86
+#: admin/tools-page.php:76
87
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
88
+msgstr "For at registrere en forbindelsestype, se <a href=\"%s\">wiki'en</a>."
89
+
90
+#: admin/tools-page.php:93
91
+msgid "Convert to registered connection type:"
92
+msgstr "Konverter til registreret forbindelsestype:"
93
+
94
+#: admin/tools-page.php:129
95
+msgid "Go"
96
+msgstr "Start"
97
+
98
+#: core/connection-type.php:102
99
+msgid "Create connections"
100
+msgstr "Opret forbindelser"
101
+
102
+#: core/connection-type.php:120
103
+msgid "Connected %s"
104
+msgstr "Forbandt %s"
105
+
106
+#: core/side-user.php:16
107
+msgid "Users"
108
+msgstr "Brugere"
109
+
110
+#: core/side-user.php:25
111
+msgid "User"
112
+msgstr "Bruger"
113
+
114
+#: core/side-user.php:26
115
+msgid "Search Users"
116
+msgstr "Søg Brugere"
117
+
118
+#: core/side-user.php:27
119
+msgid "No users found."
120
+msgstr "Ingen brugere fundet."
121
+
122
+#: core/widget.php:16
123
+msgid "Posts 2 Posts"
124
+msgstr "Posts 2 Posts"
125
+
126
+#: core/widget.php:17
127
+msgid "A list of posts connected to the current post"
128
+msgstr "En liste af indlæg forbundet med det nuværende indlæg"
129
+
130
+#: core/widget.php:34
131
+msgid "Title:"
132
+msgstr "Titel:"
133
+
134
+#: core/widget.php:41
135
+msgid "Connection type:"
136
+msgstr "Forbindelsestype:"
137
+
138
+#: core/widget.php:46
139
+msgid "Connection listing:"
140
+msgstr "Forbindelsesliste:"
141
+
142
+#: core/widget.php:52
143
+msgid "connected"
144
+msgstr "forbundet"
145
+
146
+#: core/widget.php:53
147
+msgid "related"
148
+msgstr "relateret"
149
+
150
+#: scb/AdminPage.php:227
151
+msgid "Settings <strong>saved</strong>."
152
+msgstr "Indstillinger <strong>gemt</strong>."
153
+
154
+#: scb/AdminPage.php:466
155
+msgid "Settings"
156
+msgstr "Indstillinger"

BIN
plugins/posts-to-posts/lang/posts-to-posts-de_DE.mo Переглянути файл


+ 192
- 0
plugins/posts-to-posts/lang/posts-to-posts-de_DE.po Переглянути файл

@@ -0,0 +1,192 @@
1
+# Translation of the WordPress plugin Posts 2 Posts by scribu.
2
+# Copyright (C) 2012
3
+# This file is distributed under the same license as the Posts 2 Posts package.
4
+msgid ""
5
+msgstr ""
6
+"Project-Id-Version: Posts 2 Posts\n"
7
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
8
+"POT-Creation-Date: 2011-12-01 16:28:04+00:00\n"
9
+"PO-Revision-Date: 2012-08-20 17:37+0100\n"
10
+"Last-Translator: ms-studio <code@ms-studio.net>\n"
11
+"Language-Team: \n"
12
+"Language: German\n"
13
+"MIME-Version: 1.0\n"
14
+"Content-Type: text/plain; charset=UTF-8\n"
15
+"Content-Transfer-Encoding: 8bit\n"
16
+
17
+#: admin/box.php:38
18
+msgid "Are you sure you want to delete all connections?"
19
+msgstr "Wollen Sie wirklich alle Verbindungen löschen?"
20
+
21
+#: admin/box.php:114
22
+msgid "Search"
23
+msgstr "Suchen"
24
+
25
+#: admin/box.php:191
26
+msgid "previous"
27
+msgstr "vorherige"
28
+
29
+#: admin/box.php:192
30
+msgid "next"
31
+msgstr "folgende"
32
+
33
+#: admin/box.php:193
34
+msgid "of"
35
+msgstr "von"
36
+
37
+#: admin/box.php:236
38
+msgid "Can't create connection: %s"
39
+msgstr "Verbindung kann nicht erstellt werden: %s"
40
+
41
+#: admin/factory.php:30
42
+msgid " (from)"
43
+msgstr " (von)"
44
+
45
+#: admin/factory.php:31
46
+msgid " (to)"
47
+msgstr " (zu)"
48
+
49
+#: admin/fields.php:30
50
+msgid "Delete all connections"
51
+msgstr "Alle Verbindungen löschen"
52
+
53
+#: admin/fields.php:39
54
+msgid "Delete connection"
55
+msgstr "Verbindung löschen"
56
+
57
+#: admin/tools.php:7
58
+msgid "Connection Types"
59
+msgstr "Verbindungs-Typen"
60
+
61
+#: admin/tools.php:41
62
+#, php-format
63
+msgid "<em>%s</em> is not a registered connection type."
64
+msgstr "Der Verbindungs-Typ <em>%s</em> ist nicht registriert."
65
+
66
+#: admin/tools.php:50
67
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
68
+msgstr ""
69
+"%1$s Verbindungen wurden von <em>%2$s</em> zu <em>%3$s</em> konvertiert."
70
+
71
+#: admin/tools.php:64
72
+msgid "Name"
73
+msgstr "Name"
74
+
75
+#: admin/tools.php:65
76
+msgid "Information"
77
+msgstr "Information"
78
+
79
+#: admin/tools.php:66
80
+msgid "Connections"
81
+msgstr "Verbindungen"
82
+
83
+#: admin/tools.php:74
84
+msgid "No connection types registered."
85
+msgstr "Keine Verbindungs-Typen registriert."
86
+
87
+#: admin/tools.php:76
88
+#, php-format
89
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
90
+msgstr ""
91
+"Das <a href=\"%s\">Wiki</a> bietet Anweisungen zum Erstellen von Verbindungs-"
92
+"Typen ."
93
+
94
+#: admin/tools.php:93
95
+msgid "Convert to registered connection type:"
96
+msgstr "Zu Verbindungs-Typ konvertieren:"
97
+
98
+#: admin/tools.php:129
99
+msgid "Go"
100
+msgstr ""
101
+
102
+#: core/widget.php:15
103
+msgid "Posts 2 Posts"
104
+msgstr "Posts 2 Posts"
105
+
106
+#: core/widget.php:16
107
+msgid "A list of posts connected to the current post"
108
+msgstr "Eine Liste von Artikeln, die mit diesem Artikel verbunden sind"
109
+
110
+#: core/extra.php:34
111
+msgid "Title:"
112
+msgstr "Titel"
113
+
114
+#: admin/box.php:115
115
+msgid "Create connections:"
116
+msgstr "Verbindungen erstellen:"
117
+
118
+#: core/type.php:79
119
+msgid "Create connections"
120
+msgstr "Neue Verbindung"
121
+
122
+#: admin/box.php:136
123
+msgid "View All"
124
+msgstr "Alle Verbindungen"
125
+
126
+#: admin/fields.php:16
127
+msgid "Create connection"
128
+msgstr "Verbindung erstellen"
129
+
130
+#: scb/AdminPage.php:165
131
+msgid "Settings <strong>saved</strong>."
132
+msgstr "Einstellungen <strong>gespeichert</strong>"
133
+
134
+#: scb/AdminPage.php:178 scb/AdminPage.php:189
135
+msgid "Save Changes"
136
+msgstr "Änderungen speichern"
137
+
138
+#: scb/AdminPage.php:350
139
+msgid "Settings"
140
+msgstr "Einstellungen"
141
+
142
+#: core/type.php:65
143
+msgid "Connected %s"
144
+msgstr "Verbundene %s"
145
+
146
+#: core/widget.php:37
147
+msgid "Connection type:"
148
+msgstr "Verbindungs-Typ:"
149
+
150
+#: core/widget.php:41
151
+msgid "Connection listing:"
152
+msgstr "Verbindungs-Liste:"
153
+
154
+#: core/widget.php:47
155
+msgid "connected"
156
+msgstr "verbunden"
157
+
158
+#: core/widget.php:48
159
+msgid "related"
160
+msgstr "verwandt"
161
+
162
+#: core/widget.php:73
163
+msgid "Related %s"
164
+msgstr "Verwandte %s"
165
+
166
+#: core/storage.php:35
167
+msgid "Upgraded %d connections."
168
+msgstr "%d Verbindungen wurden ge-upgradet"
169
+
170
+#: core/storage.php:38
171
+msgid ""
172
+"The Posts 2 Posts connections need to be upgraded. <a href=\"%s\">Proceed.</"
173
+"a>"
174
+msgstr ""
175
+"Die Posts 2 Posts Verbindungen benötigen ein Upgrade. <a href=\"%s"
176
+"\">Ausführen.</a>"
177
+
178
+#: core/side.php:110
179
+msgid "Users"
180
+msgstr "Benutzer"
181
+
182
+#: core/side.php:115
183
+msgid "User"
184
+msgstr "Benutzer"
185
+
186
+#: core/side.php:116
187
+msgid "Search Users"
188
+msgstr "Benutzer suchen"
189
+
190
+#: core/side.php:117
191
+msgid "No users found."
192
+msgstr "Keine Benutzer gefunden."

BIN
plugins/posts-to-posts/lang/posts-to-posts-es_ES.mo Переглянути файл


+ 153
- 0
plugins/posts-to-posts/lang/posts-to-posts-es_ES.po Переглянути файл

@@ -0,0 +1,153 @@
1
+# Copyright (C) 2013 
2
+# This file is distributed under the same license as the  package.
3
+msgid ""
4
+msgstr ""
5
+"Project-Id-Version:  \n"
6
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
7
+"POT-Creation-Date: 2013-02-17 08:06:11+00:00\n"
8
+"MIME-Version: 1.0\n"
9
+"Content-Type: text/plain; charset=UTF-8\n"
10
+"Content-Transfer-Encoding: 8bit\n"
11
+"PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
+"Last-Translator: Alejandro Schwartz <alejandro@alejandroschwartz.com>\n"
13
+"Language-Team: Español <LL@li.org>\n"
14
+
15
+#: admin/box.php:45
16
+msgid "Are you sure you want to delete all connections?"
17
+msgstr "¿Está seguro de que desea borrar todas las conexiones?"
18
+
19
+#: admin/box.php:136
20
+msgid "Search"
21
+msgstr "Buscar"
22
+
23
+#: admin/box.php:213
24
+msgid "previous"
25
+msgstr "anterior"
26
+
27
+#: admin/box.php:214
28
+msgid "next"
29
+msgstr "siguiente"
30
+
31
+#: admin/box.php:215
32
+msgid "of"
33
+msgstr "desactivado"
34
+
35
+#: admin/dropdown-user.php:32
36
+msgid "Filter"
37
+msgstr "Filtrar"
38
+
39
+#: admin/factory.php:88
40
+msgid " (from)"
41
+msgstr " (desde)"
42
+
43
+#: admin/factory.php:89
44
+msgid " (to)"
45
+msgstr " (hasta)"
46
+
47
+#: admin/field-delete.php:7
48
+msgid "Delete all connections"
49
+msgstr "Borrar todas las conexiones"
50
+
51
+#: admin/field-delete.php:16
52
+msgid "Delete connection"
53
+msgstr "Borrar conexión"
54
+
55
+#: admin/tools-page.php:7
56
+msgid "Connection Types"
57
+msgstr "Tipos de conexiones"
58
+
59
+#: admin/tools-page.php:41
60
+msgid "<em>%s</em> is not a registered connection type."
61
+msgstr "<em>%s</em> no es un tipo de conexión registrada."
62
+
63
+#: admin/tools-page.php:50
64
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
65
+msgstr "Se han convertido %1$s conexiones de <em>%2$s</em> a <em>%3$s</em>."
66
+
67
+#: admin/tools-page.php:64
68
+msgid "Name"
69
+msgstr "Nombre"
70
+
71
+#: admin/tools-page.php:65
72
+msgid "Information"
73
+msgstr "Información"
74
+
75
+#: admin/tools-page.php:66
76
+msgid "Connections"
77
+msgstr "Conexiones"
78
+
79
+#: admin/tools-page.php:74
80
+msgid "No connection types registered."
81
+msgstr "No hay ningún tipo de conexiones registradas"
82
+
83
+#: admin/tools-page.php:76
84
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
85
+msgstr "Para registrar un tipo de conexión, vea <a href=\"%s\">the wiki</a>."
86
+
87
+#: admin/tools-page.php:93
88
+msgid "Convert to registered connection type:"
89
+msgstr "Convertir a un tipo de conexión registrada:"
90
+
91
+#: admin/tools-page.php:129
92
+msgid "Go"
93
+msgstr "Ir"
94
+
95
+#: core/connection-type.php:102
96
+msgid "Create connections"
97
+msgstr "Crear conexiones"
98
+
99
+#: core/connection-type.php:120
100
+msgid "Connected %s"
101
+msgstr "Conexiones de %s"
102
+
103
+#: core/side-user.php:16
104
+msgid "Users"
105
+msgstr "Usuarios"
106
+
107
+#: core/side-user.php:25
108
+msgid "User"
109
+msgstr "Usuario"
110
+
111
+#: core/side-user.php:26
112
+msgid "Search Users"
113
+msgstr "Buscar usuarios"
114
+
115
+#: core/side-user.php:27
116
+msgid "No users found."
117
+msgstr "No se encontraron usuarios"
118
+
119
+#: core/widget.php:16
120
+msgid "Posts 2 Posts"
121
+msgstr "Posts 2 Posts"
122
+
123
+#: core/widget.php:17
124
+msgid "A list of posts connected to the current post"
125
+msgstr "Una lista de los posts conectados al post actual"
126
+
127
+#: core/widget.php:34
128
+msgid "Title:"
129
+msgstr "Título"
130
+
131
+#: core/widget.php:41
132
+msgid "Connection type:"
133
+msgstr "Tipo de conexión:"
134
+
135
+#: core/widget.php:46
136
+msgid "Connection listing:"
137
+msgstr "Lista de conexiones:"
138
+
139
+#: core/widget.php:52
140
+msgid "connected"
141
+msgstr "Conectado"
142
+
143
+#: core/widget.php:53
144
+msgid "related"
145
+msgstr "relacionados"
146
+
147
+#: scb/AdminPage.php:227
148
+msgid "Settings <strong>saved</strong>."
149
+msgstr "Configuración <strong>guardada</strong>."
150
+
151
+#: scb/AdminPage.php:466
152
+msgid "Settings"
153
+msgstr "Configuración"

BIN
plugins/posts-to-posts/lang/posts-to-posts-et_EE.mo Переглянути файл


+ 233
- 0
plugins/posts-to-posts/lang/posts-to-posts-et_EE.po Переглянути файл

@@ -0,0 +1,233 @@
1
+msgid ""
2
+msgstr ""
3
+"Project-Id-Version: Posts 2 Posts v1.6\n"
4
+"Report-Msgid-Bugs-To: \n"
5
+"POT-Creation-Date: \n"
6
+"PO-Revision-Date: 2013-05-17 22:15:56+0000\n"
7
+"Last-Translator: admin <risto.niinemets@gmail.com>\n"
8
+"Language-Team: \n"
9
+"MIME-Version: 1.0\n"
10
+"Content-Type: text/plain; charset=UTF-8\n"
11
+"Content-Transfer-Encoding: 8bit\n"
12
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+"X-Generator: CSL v1.x\n"
14
+"X-Poedit-Language: Estonian\n"
15
+"X-Poedit-Country: ESTONIA\n"
16
+"X-Poedit-SourceCharset: utf-8\n"
17
+"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
18
+"X-Poedit-Basepath: ../\n"
19
+"X-Poedit-Bookmarks: \n"
20
+"X-Poedit-SearchPath-0: .\n"
21
+"X-Textdomain-Support: yes"
22
+
23
+#: admin/box.php:45
24
+#@ posts-to-posts
25
+msgid "Are you sure you want to delete all connections?"
26
+msgstr "Kas oled kindel, et soovid kõik ühendused eemaldada?"
27
+
28
+#: admin/box.php:137
29
+#@ posts-to-posts
30
+msgid "Search"
31
+msgstr "Otsi"
32
+
33
+#: admin/box.php:224
34
+#@ posts-to-posts
35
+msgid "previous"
36
+msgstr "eelmine"
37
+
38
+#: admin/box.php:225
39
+#@ posts-to-posts
40
+msgid "next"
41
+msgstr "järgmine"
42
+
43
+#: admin/box.php:226
44
+#@ posts-to-posts
45
+msgid "of"
46
+msgstr ""
47
+
48
+#: admin/dropdown-user.php:32
49
+#@ posts-to-posts
50
+msgid "Filter"
51
+msgstr "Filtreeri"
52
+
53
+#: admin/factory.php:88
54
+#@ posts-to-posts
55
+msgid " (from)"
56
+msgstr "(algus)"
57
+
58
+#: admin/factory.php:89
59
+#@ posts-to-posts
60
+msgid " (to)"
61
+msgstr "(lõpp)"
62
+
63
+#: admin/field-delete.php:7
64
+#@ posts-to-posts
65
+msgid "Delete all connections"
66
+msgstr "Eemalda ühendused"
67
+
68
+#: admin/field-delete.php:16
69
+#@ posts-to-posts
70
+msgid "Delete connection"
71
+msgstr "Eemalda ühendus"
72
+
73
+#: admin/tools-page.php:7
74
+#@ posts-to-posts
75
+msgid "Connection Types"
76
+msgstr "Ühenduse tüübid"
77
+
78
+#: admin/tools-page.php:41
79
+#, php-format
80
+#@ posts-to-posts
81
+msgid "<em>%s</em> is not a registered connection type."
82
+msgstr "<em>%s</em> ei ole registreeritud ühenduse tüüp."
83
+
84
+#: admin/tools-page.php:50
85
+#, php-format
86
+#@ posts-to-posts
87
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
88
+msgstr "Muuda %1$s ühendused <em>%2$s</em> -> <em>%3$s</em>."
89
+
90
+#: admin/tools-page.php:64
91
+#@ posts-to-posts
92
+msgid "Name"
93
+msgstr "Nimetus"
94
+
95
+#: admin/tools-page.php:65
96
+#@ posts-to-posts
97
+msgid "Information"
98
+msgstr "Informatsioon"
99
+
100
+#: admin/tools-page.php:66
101
+#@ posts-to-posts
102
+msgid "Connections"
103
+msgstr "Ühenduste arv"
104
+
105
+#: admin/tools-page.php:74
106
+#@ posts-to-posts
107
+msgid "No connection types registered."
108
+msgstr "Ühenduse tüüpe ei ole registreeritud."
109
+
110
+#: admin/tools-page.php:76
111
+#, php-format
112
+#@ posts-to-posts
113
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
114
+msgstr "Uue ühenduse registreerimiseks vaata <a href=\"%s\">wikit</a>."
115
+
116
+#: admin/tools-page.php:93
117
+#@ posts-to-posts
118
+msgid "Convert to registered connection type:"
119
+msgstr "Muuda regisreeritud ühenduse tüübiks:"
120
+
121
+#: admin/tools-page.php:129
122
+#@ posts-to-posts
123
+msgid "Go"
124
+msgstr "Mine"
125
+
126
+#: core/connection-type.php:91
127
+#@ posts-to-posts
128
+msgid "Create connections"
129
+msgstr "Loo ühendus"
130
+
131
+#: core/connection-type.php:109
132
+#, php-format
133
+#@ posts-to-posts
134
+msgid "Connected %s"
135
+msgstr "Ühendused: %s"
136
+
137
+#: core/side-user.php:16
138
+#@ posts-to-posts
139
+msgid "Users"
140
+msgstr "Kasutajad"
141
+
142
+#: core/side-user.php:25
143
+#@ posts-to-posts
144
+msgid "User"
145
+msgstr "Kasutaja"
146
+
147
+#: core/side-user.php:26
148
+#@ posts-to-posts
149
+msgid "Search Users"
150
+msgstr "Otsi kasutajaid"
151
+
152
+#: core/side-user.php:27
153
+#@ posts-to-posts
154
+msgid "No users found."
155
+msgstr "Kasutajaid ei leitud."
156
+
157
+#. translators: plugin header field 'Name'
158
+#: core/widget.php:16
159
+#: posts-to-posts.php:0
160
+#@ posts-to-posts
161
+msgid "Posts 2 Posts"
162
+msgstr "Posts 2 Posts"
163
+
164
+#: core/widget.php:17
165
+#@ posts-to-posts
166
+msgid "A list of posts connected to the current post"
167
+msgstr "Nimekiri selle postituse külge ühendatud postitustest"
168
+
169
+#: core/widget.php:34
170
+#@ posts-to-posts
171
+msgid "Title:"
172
+msgstr "Pealkiri:"
173
+
174
+#: core/widget.php:41
175
+#@ posts-to-posts
176
+msgid "Connection type:"
177
+msgstr "Ühenduse tüüp:"
178
+
179
+#: core/widget.php:46
180
+#@ posts-to-posts
181
+msgid "Connection listing:"
182
+msgstr "Ühendused:"
183
+
184
+#: core/widget.php:52
185
+#@ posts-to-posts
186
+msgid "connected"
187
+msgstr "ühendatud"
188
+
189
+#: core/widget.php:53
190
+#@ posts-to-posts
191
+msgid "related"
192
+msgstr "seotud"
193
+
194
+#. translators: plugin header field 'PluginURI'
195
+#: posts-to-posts.php:0
196
+#@ posts-to-posts
197
+msgid "http://scribu.net/wordpress/posts-to-posts"
198
+msgstr "http://scribu.net/wordpress/posts-to-posts"
199
+
200
+#. translators: plugin header field 'Description'
201
+#: posts-to-posts.php:0
202
+#@ posts-to-posts
203
+msgid "Create many-to-many relationships between all types of posts."
204
+msgstr "Loo mitmeid ühendusi kõikide postituste tüüpide vahel."
205
+
206
+#. translators: plugin header field 'Author'
207
+#: posts-to-posts.php:0
208
+#@ posts-to-posts
209
+msgid "scribu"
210
+msgstr "scribu"
211
+
212
+#. translators: plugin header field 'AuthorURI'
213
+#: posts-to-posts.php:0
214
+#@ posts-to-posts
215
+msgid "http://scribu.net/"
216
+msgstr "http://scribu.net/"
217
+
218
+#. translators: plugin header field 'Version'
219
+#: posts-to-posts.php:0
220
+#@ posts-to-posts
221
+msgid "1.6"
222
+msgstr "1.6"
223
+
224
+#: scb/AdminPage.php:227
225
+#@ posts-to-posts
226
+msgid "Settings <strong>saved</strong>."
227
+msgstr "Seaded <strong>salvestatud</strong>."
228
+
229
+#: scb/AdminPage.php:466
230
+#@ posts-to-posts
231
+msgid "Settings"
232
+msgstr "Seaded"
233
+

BIN
plugins/posts-to-posts/lang/posts-to-posts-fa_IR.mo Переглянути файл


+ 142
- 0
plugins/posts-to-posts/lang/posts-to-posts-fa_IR.po Переглянути файл

@@ -0,0 +1,142 @@
1
+msgid ""
2
+msgstr ""
3
+"Project-Id-Version: \n"
4
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
5
+"POT-Creation-Date: 2011-09-24 13:12:56+00:00\n"
6
+"PO-Revision-Date: 2011-09-25 19:00+0330\n"
7
+"Last-Translator: geminorum <contact@geminorum.ir>\n"
8
+"Language-Team: LANGUAGE <LL@li.org>\n"
9
+"MIME-Version: 1.0\n"
10
+"Content-Type: text/plain; charset=UTF-8\n"
11
+"Content-Transfer-Encoding: 8bit\n"
12
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+"X-Poedit-SourceCharset: utf-8\n"
14
+"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
15
+"X-Textdomain-Support: yes\n"
16
+"X-Poedit-SearchPath-0: .\n"
17
+
18
+#@ posts-to-posts
19
+#: scb/AdminPage.php:163
20
+msgid "Settings <strong>saved</strong>."
21
+msgstr "تنظیمات <strong>ذخیره</strong> شد."
22
+
23
+#@ posts-to-posts
24
+#: scb/AdminPage.php:176
25
+#: scb/AdminPage.php:187
26
+msgid "Save Changes"
27
+msgstr "ذخیره تغییرات"
28
+
29
+#@ posts-to-posts
30
+#: scb/AdminPage.php:348
31
+msgid "Settings"
32
+msgstr "تنظیمات"
33
+
34
+#@ posts-to-posts
35
+#: admin/fields.php:13
36
+msgid "Create connection"
37
+msgstr "برقراری ارتباط"
38
+
39
+#@ posts-to-posts
40
+#: admin/fields.php:25
41
+msgid "Delete all connections"
42
+msgstr "پاک‌کردن همه ارتباط‌ها"
43
+
44
+#@ posts-to-posts
45
+#: admin/fields.php:34
46
+msgid "Delete connection"
47
+msgstr "پاک‌کردن ارتباط"
48
+
49
+#@ posts-to-posts
50
+#: admin/box.php:59
51
+msgid "Are you sure you want to delete all connections?"
52
+msgstr "از پاک‌کردن همه ارتباط‌ها اطمینان دارید؟"
53
+
54
+#@ posts-to-posts
55
+#: admin/box.php:69
56
+#, php-format
57
+msgid "Connected %s"
58
+msgstr "%sی مرتبط"
59
+
60
+#@ posts-to-posts
61
+#: admin/box.php:116
62
+msgid "Create connections:"
63
+msgstr "برقراری ارتباط:"
64
+
65
+#@ posts-to-posts
66
+#: admin/box.php:125
67
+msgid "Search"
68
+msgstr "جست‌وجو"
69
+
70
+#@ posts-to-posts
71
+#: admin/box.php:133
72
+msgid "View All"
73
+msgstr "نمایش همه"
74
+
75
+#@ posts-to-posts
76
+#: admin/box.php:216
77
+msgid "previous"
78
+msgstr "قبلی"
79
+
80
+#@ posts-to-posts
81
+#: admin/box.php:217
82
+msgid "next"
83
+msgstr "بعدی"
84
+
85
+#@ posts-to-posts
86
+#: admin/box.php:218
87
+msgid "of"
88
+msgstr "از"
89
+
90
+#@ posts-to-posts
91
+#. translators: plugin header field 'Name'
92
+#: core/widget.php:14
93
+#: posts-to-posts.php:0
94
+msgid "Posts 2 Posts"
95
+msgstr "نوشته‌ها به نوشته‌ها"
96
+
97
+#@ posts-to-posts
98
+#: core/widget.php:15
99
+msgid "A list of posts connected to the current post"
100
+msgstr "فهرستی از همه نوشته‌های مرتبط با این نوشته"
101
+
102
+#@ posts-to-posts
103
+#: core/widget.php:29
104
+msgid "Connection type:"
105
+msgstr "نوع ارتباط:"
106
+
107
+#@ posts-to-posts
108
+#: core/widget.php:53
109
+#, php-format
110
+msgid "Related %s"
111
+msgstr "%sی وابسته"
112
+
113
+#@ posts-to-posts
114
+#. translators: plugin header field 'PluginURI'
115
+#: posts-to-posts.php:0
116
+msgid "http://scribu.net/wordpress/posts-to-posts"
117
+msgstr ""
118
+
119
+#@ posts-to-posts
120
+#. translators: plugin header field 'Description'
121
+#: posts-to-posts.php:0
122
+msgid "Create many-to-many relationships between all types of posts."
123
+msgstr "ارتباط‌های تو در تو بین انواع نوشته‌ها برقرار کنید."
124
+
125
+#@ posts-to-posts
126
+#. translators: plugin header field 'Author'
127
+#: posts-to-posts.php:0
128
+msgid "scribu"
129
+msgstr ""
130
+
131
+#@ posts-to-posts
132
+#. translators: plugin header field 'AuthorURI'
133
+#: posts-to-posts.php:0
134
+msgid "http://scribu.net/"
135
+msgstr ""
136
+
137
+#@ posts-to-posts
138
+#. translators: plugin header field 'Version'
139
+#: posts-to-posts.php:0
140
+msgid "0.9.1-beta"
141
+msgstr ""
142
+

BIN
plugins/posts-to-posts/lang/posts-to-posts-fi.mo Переглянути файл


+ 156
- 0
plugins/posts-to-posts/lang/posts-to-posts-fi.po Переглянути файл

@@ -0,0 +1,156 @@
1
+msgid ""
2
+msgstr ""
3
+"Project-Id-Version: Posts 2 Posts\n"
4
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
5
+"POT-Creation-Date: 2013-02-17 08:06:11+00:00\n"
6
+"PO-Revision-Date: \n"
7
+"Last-Translator: Daniel Koskinen <daniel.koskinen@gmail.com>\n"
8
+"Language-Team: Daniel Koskinen <dani@dani.fi>\n"
9
+"MIME-Version: 1.0\n"
10
+"Content-Type: text/plain; charset=UTF-8\n"
11
+"Content-Transfer-Encoding: 8bit\n"
12
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+"X-Poedit-Language: Finnish\n"
14
+"X-Poedit-Country: FINLAND\n"
15
+"X-Poedit-SourceCharset: utf-8\n"
16
+
17
+#: admin/box.php:45
18
+msgid "Are you sure you want to delete all connections?"
19
+msgstr "Haluatko varmasti poistaa kaikki yhteydet?"
20
+
21
+#: admin/box.php:136
22
+msgid "Search"
23
+msgstr "Hae"
24
+
25
+#: admin/box.php:213
26
+msgid "previous"
27
+msgstr "edellinen"
28
+
29
+#: admin/box.php:214
30
+msgid "next"
31
+msgstr "seuraava"
32
+
33
+#: admin/box.php:215
34
+msgid "of"
35
+msgstr "/"
36
+
37
+#: admin/dropdown-user.php:32
38
+msgid "Filter"
39
+msgstr "Suodata"
40
+
41
+#: admin/factory.php:88
42
+msgid " (from)"
43
+msgstr " (lähde)"
44
+
45
+#: admin/factory.php:89
46
+msgid " (to)"
47
+msgstr " (kohde)"
48
+
49
+#: admin/field-delete.php:7
50
+msgid "Delete all connections"
51
+msgstr "Poista kaikki yhteydet"
52
+
53
+#: admin/field-delete.php:16
54
+msgid "Delete connection"
55
+msgstr "Poista yhteys"
56
+
57
+#: admin/tools-page.php:7
58
+msgid "Connection Types"
59
+msgstr "Yhteystyyppi"
60
+
61
+#: admin/tools-page.php:41
62
+msgid "<em>%s</em> is not a registered connection type."
63
+msgstr "<em>%s</em> ei ole rekisteröity yhteystyyppi."
64
+
65
+#: admin/tools-page.php:50
66
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
67
+msgstr "%1$s yhteyden tyyppi on vaihdettu. Alkuperäinen tyyppi: <em>%2$s</em>. Uusi tyyppi: <em>%3$s</em>."
68
+
69
+#: admin/tools-page.php:64
70
+msgid "Name"
71
+msgstr "Nimi"
72
+
73
+#: admin/tools-page.php:65
74
+msgid "Information"
75
+msgstr "Tiedot"
76
+
77
+#: admin/tools-page.php:66
78
+msgid "Connections"
79
+msgstr "Yhteydet"
80
+
81
+#: admin/tools-page.php:74
82
+msgid "No connection types registered."
83
+msgstr "Yhteystyyppejä ei ole rekisteröity"
84
+
85
+#: admin/tools-page.php:76
86
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
87
+msgstr "Katso <a href=\"%s\">wikistä</a> ohjeet yhteystyyppien rekisteröimiseen."
88
+
89
+#: admin/tools-page.php:93
90
+msgid "Convert to registered connection type:"
91
+msgstr "Vaihda rekisteröityyn yhteystyyppiin:"
92
+
93
+#: admin/tools-page.php:129
94
+msgid "Go"
95
+msgstr "OK"
96
+
97
+#: core/connection-type.php:102
98
+msgid "Create connections"
99
+msgstr "Lisää yhteys"
100
+
101
+#: core/connection-type.php:120
102
+msgid "Connected %s"
103
+msgstr "Liitetyt %s"
104
+
105
+#: core/side-user.php:16
106
+msgid "Users"
107
+msgstr "Käyttäjät"
108
+
109
+#: core/side-user.php:25
110
+msgid "User"
111
+msgstr "Käyttäjä"
112
+
113
+#: core/side-user.php:26
114
+msgid "Search Users"
115
+msgstr "Hae käyttäjiä"
116
+
117
+#: core/side-user.php:27
118
+msgid "No users found."
119
+msgstr "Käyttäjiä ei löytynyt"
120
+
121
+#: core/widget.php:16
122
+msgid "Posts 2 Posts"
123
+msgstr "Posts 2 Posts"
124
+
125
+#: core/widget.php:17
126
+msgid "A list of posts connected to the current post"
127
+msgstr "Tähän artikkeliin liitetyt sisällöt"
128
+
129
+#: core/widget.php:34
130
+msgid "Title:"
131
+msgstr "Otsikko:"
132
+
133
+#: core/widget.php:41
134
+msgid "Connection type:"
135
+msgstr "Yhteystyyppi:"
136
+
137
+#: core/widget.php:46
138
+msgid "Connection listing:"
139
+msgstr "Listan sisältö:"
140
+
141
+#: core/widget.php:52
142
+msgid "connected"
143
+msgstr "yhteydet"
144
+
145
+#: core/widget.php:53
146
+msgid "related"
147
+msgstr "rinnakkaiset"
148
+
149
+#: scb/AdminPage.php:227
150
+msgid "Settings <strong>saved</strong>."
151
+msgstr "Asetukset <strong>tallennettu</strong>."
152
+
153
+#: scb/AdminPage.php:466
154
+msgid "Settings"
155
+msgstr "Asetukset"
156
+

BIN
plugins/posts-to-posts/lang/posts-to-posts-fr_FR.mo Переглянути файл


+ 180
- 0
plugins/posts-to-posts/lang/posts-to-posts-fr_FR.po Переглянути файл

@@ -0,0 +1,180 @@
1
+# Translation of the WordPress plugin Posts 2 Posts 0.7-beta by scribu.
2
+# Copyright (C) 2011 scribu
3
+# This file is distributed under the same license as the Posts 2 Posts package.
4
+# Translators:
5
+# Michael Wassmer <mike@mwm-webdesign.com>, 2011.
6
+# ms-studio <code@ms-studio.net>, 2012.
7
+#
8
+msgid ""
9
+msgstr ""
10
+"Project-Id-Version: Posts 2 Posts\n"
11
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/posts-to-posts\n"
12
+"POT-Creation-Date: 2011-03-30 21:56+0300\n"
13
+"PO-Revision-Date: 2012-08-20 18:21+0100\n"
14
+"Last-Translator: ms-studio <code@ms-studio.net>\n"
15
+"Language-Team: \n"
16
+"MIME-Version: 1.0\n"
17
+"Content-Type: text/plain; charset=UTF-8\n"
18
+"Content-Transfer-Encoding: 8bit\n"
19
+
20
+#: admin/box.php:114
21
+msgid "Search"
22
+msgstr "Recherche"
23
+
24
+#: ui/boxes.php:108
25
+msgid "Previous"
26
+msgstr "Précédent"
27
+
28
+#: ui/boxes.php:109
29
+msgid "of"
30
+msgstr "sur"
31
+
32
+#: ui/boxes.php:110
33
+msgid "Next"
34
+msgstr "Suivant"
35
+
36
+#: scb/AdminPage.php:164
37
+msgid "Settings <strong>saved</strong>."
38
+msgstr "Réglages <strong>Enregistrés</strong>"
39
+
40
+#: scb/AdminPage.php:176 scb/AdminPage.php:186
41
+msgid "Save Changes"
42
+msgstr "Enregistrer Modifications"
43
+
44
+#: scb/AdminPage.php:368
45
+msgid "Settings"
46
+msgstr "Réglages"
47
+
48
+#: ui/boxes.php:88
49
+msgid "Create connections:"
50
+msgstr "Créer une connexion:"
51
+
52
+#: ui/boxes.php:114
53
+msgid "Recent"
54
+msgstr "Récent"
55
+
56
+#: ui/boxes.php:174 ui/boxes.php:175
57
+msgid "Create connection"
58
+msgstr "Nouvelle connexion"
59
+
60
+#: ui/boxes.php:182 ui/boxes.php:183
61
+msgid "Delete connection"
62
+msgstr "Supprimer la connexion"
63
+
64
+#: ui/boxes.php:189 ui/boxes.php:190
65
+msgid "Delete all connections"
66
+msgstr "Supprimer toutes les connexions"
67
+
68
+#: ui/ui.php:40
69
+#, php-format
70
+msgid "Connected %s"
71
+msgstr "%s Connectées"
72
+
73
+#: ui/ui.php:87
74
+msgid "Are you sure you want to delete all connections?"
75
+msgstr "Etes-vous sûr de vouloir supprimer toutes les connexions?"
76
+
77
+#. Plugin Name of the plugin/theme
78
+msgid "Posts 2 Posts"
79
+msgstr "Posts 2 Posts"
80
+
81
+#. Description of the plugin/theme
82
+msgid "Create many-to-many relationships between all types of posts"
83
+msgstr "Créer des relations multiples entre tous types d’articles et de pages"
84
+
85
+#: admin/box.php:236
86
+msgid "Can't create connection: %s"
87
+msgstr "Impossible de créer la connexion: %s"
88
+
89
+#: admin/factory.php:30
90
+msgid " (from)"
91
+msgstr " (de)"
92
+
93
+#: admin/factory.php:31
94
+msgid " (to)"
95
+msgstr " (à)"
96
+
97
+#: admin/tools.php:7
98
+msgid "Connection Types"
99
+msgstr "Types de Connexion"
100
+
101
+#: admin/tools.php:41
102
+msgid "<em>%s</em> is not a registered connection type."
103
+msgstr "<em>%s</em> n'est pas un type de connexion enregistré."
104
+
105
+#: admin/tools.php:50
106
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
107
+msgstr "%1$s connexions converties de <em>%2$s</em> à <em>%3$s</em>."
108
+
109
+#: admin/tools.php:64
110
+msgid "Name"
111
+msgstr "Nom"
112
+
113
+#: admin/tools.php:65
114
+msgid "Information"
115
+msgstr "Information"
116
+
117
+#: admin/tools.php:66
118
+msgid "Connections"
119
+msgstr "Connexions"
120
+
121
+#: admin/tools.php:74
122
+msgid "No connection types registered."
123
+msgstr "Aucun type de connexion enregistré."
124
+
125
+#: admin/tools.php:76
126
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
127
+msgstr ""
128
+"Pour enregistrer un type de connexion, consulter <a href=\"%s\">le wiki</a>."
129
+
130
+#: admin/tools.php:93
131
+msgid "Convert to registered connection type:"
132
+msgstr "Convertir en type de connexion:"
133
+
134
+#: admin/tools.php:129
135
+msgid "Go"
136
+msgstr "Go"
137
+
138
+#: core/extra.php:17
139
+msgid "A list of posts connected to the current post"
140
+msgstr "Une liste d'articles connectés à l'article courant"
141
+
142
+#: core/extra.php:34
143
+msgid "Title:"
144
+msgstr "Titre:"
145
+
146
+#: core/extra.php:41
147
+msgid "Connection type:"
148
+msgstr "Type de connexion:"
149
+
150
+#: core/extra.php:46
151
+msgid "Connection listing:"
152
+msgstr "Liste de connexions:"
153
+
154
+#: core/extra.php:52
155
+msgid "connected"
156
+msgstr "relié"
157
+
158
+#: core/extra.php:53
159
+msgid "related"
160
+msgstr "lié"
161
+
162
+#: core/side.php:210
163
+msgid "Users"
164
+msgstr "Utilisateurs"
165
+
166
+#: core/side.php:219
167
+msgid "User"
168
+msgstr "Utilisateur"
169
+
170
+#: core/side.php:220
171
+msgid "Search Users"
172
+msgstr "Rechercher les utilisateurs"
173
+
174
+#: core/side.php:221
175
+msgid "No users found."
176
+msgstr "Aucun utilisateur trouvé."
177
+
178
+#: core/type.php:79
179
+msgid "Create connections"
180
+msgstr "Nouvelle connexion"

BIN
plugins/posts-to-posts/lang/posts-to-posts-hr.mo Переглянути файл


+ 73
- 0
plugins/posts-to-posts/lang/posts-to-posts-hr.po Переглянути файл

@@ -0,0 +1,73 @@
1
+# Copyright (C) 2010 
2
+# This file is distributed under the same license as the  package.
3
+msgid ""
4
+msgstr ""
5
+"Project-Id-Version: \n"
6
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
7
+"POT-Creation-Date: 2011-09-18 21:35:49+00:00\n"
8
+"MIME-Version: 1.0\n"
9
+"Content-Type: text/plain; charset=UTF-8\n"
10
+"Content-Transfer-Encoding: 8bit\n"
11
+"PO-Revision-Date: 2011-09-19 12:57+0200\n"
12
+"Last-Translator: scribu <scribu@gmail.com>\n"
13
+"Language-Team: \n"
14
+"X-Poedit-Language: Croatian\n"
15
+"X-Poedit-Country: CROATIA\n"
16
+
17
+#: scb/AdminPage.php:163
18
+msgid "Settings <strong>saved</strong>."
19
+msgstr "Postavke <strong>spremljene</strong>."
20
+
21
+#: scb/AdminPage.php:176
22
+#: scb/AdminPage.php:187
23
+msgid "Save Changes"
24
+msgstr "Spremi Promjene"
25
+
26
+#: scb/AdminPage.php:348
27
+msgid "Settings"
28
+msgstr "Postavke"
29
+
30
+#: admin/fields.php:13
31
+msgid "Create connection"
32
+msgstr "Izradi poveznicu"
33
+
34
+#: admin/fields.php:25
35
+msgid "Delete all connections"
36
+msgstr "Izbriši sve poveznice"
37
+
38
+#: admin/fields.php:34
39
+msgid "Delete connection"
40
+msgstr "Obriši poveznicu"
41
+
42
+#: admin/box.php:58
43
+msgid "Are you sure you want to delete all connections?"
44
+msgstr "Sigurno želiš obrisati sve poveznice"
45
+
46
+#: admin/box.php:68
47
+msgid "Connected %s"
48
+msgstr "Povezano %s"
49
+
50
+#: admin/box.php:115
51
+msgid "Create connections:"
52
+msgstr "Izradi poveznice:"
53
+
54
+#: admin/box.php:124
55
+msgid "Search"
56
+msgstr "Pretraži"
57
+
58
+#: admin/box.php:132
59
+msgid "View All"
60
+msgstr "Pregledaj Sve"
61
+
62
+#: admin/box.php:215
63
+msgid "previous"
64
+msgstr "prethodna"
65
+
66
+#: admin/box.php:216
67
+msgid "next"
68
+msgstr "slijedeća"
69
+
70
+#: admin/box.php:217
71
+msgid "of"
72
+msgstr "od"
73
+

BIN
plugins/posts-to-posts/lang/posts-to-posts-it_IT.mo Переглянути файл


+ 133
- 0
plugins/posts-to-posts/lang/posts-to-posts-it_IT.po Переглянути файл

@@ -0,0 +1,133 @@
1
+# Copyright (C) 2011 
2
+# This file is distributed under the same license as the  package.
3
+msgid ""
4
+msgstr ""
5
+"Project-Id-Version: Posts 2 Posts 1.1.4\n"
6
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
7
+"POT-Creation-Date: 2011-12-01 16:28:04+00:00\n"
8
+"MIME-Version: 1.0\n"
9
+"Content-Type: text/plain; charset=UTF-8\n"
10
+"Content-Transfer-Encoding: 8bit\n"
11
+"PO-Revision-Date: 2012-06-21 22:25+0200\n"
12
+"Last-Translator: Andrea Bersi\n"
13
+"Language-Team: \n"
14
+"X-Poedit-Language: Italian\n"
15
+"X-Poedit-Country: ITALY\n"
16
+
17
+#: admin/box-factory.php:56
18
+msgid " (from)"
19
+msgstr " (da)"
20
+
21
+#: admin/box-factory.php:57
22
+msgid " (to)"
23
+msgstr " (a)"
24
+
25
+#: admin/box.php:42
26
+msgid "Are you sure you want to delete all connections?"
27
+msgstr "Confermi la rimozione di tutte le relazioni?"
28
+
29
+#: admin/box.php:115
30
+msgid "Create connections:"
31
+msgstr "Crea relazioni:"
32
+
33
+#: admin/box.php:128
34
+msgid "Search"
35
+msgstr "Cerca"
36
+
37
+#: admin/box.php:136
38
+msgid "View All"
39
+msgstr "Vedi tutti"
40
+
41
+#: admin/box.php:204
42
+msgid "previous"
43
+msgstr "precedente"
44
+
45
+#: admin/box.php:205
46
+msgid "next"
47
+msgstr "successivo"
48
+
49
+#: admin/box.php:206
50
+msgid "of"
51
+msgstr "di"
52
+
53
+#: admin/fields.php:16
54
+msgid "Create connection"
55
+msgstr "Crea relazione"
56
+
57
+#: admin/fields.php:30
58
+msgid "Delete all connections"
59
+msgstr "Cancella tutte le relazioni"
60
+
61
+#: admin/fields.php:39
62
+msgid "Delete connection"
63
+msgstr "Cancella relazione"
64
+
65
+#: scb/AdminPage.php:165
66
+msgid "Settings <strong>saved</strong>."
67
+msgstr "Impostazioni <strong>salvate</strong>"
68
+
69
+#: scb/AdminPage.php:178
70
+#: scb/AdminPage.php:189
71
+msgid "Save Changes"
72
+msgstr "Salva"
73
+
74
+#: scb/AdminPage.php:350
75
+msgid "Settings"
76
+msgstr "Impostazioni"
77
+
78
+#: core/type.php:65
79
+msgid "Connected %s"
80
+msgstr "Collegato %s"
81
+
82
+#: core/widget.php:15
83
+msgid "Posts 2 Posts"
84
+msgstr "Posts 2 Posts"
85
+
86
+#: core/widget.php:16
87
+msgid "A list of posts connected to the current post"
88
+msgstr "Elenco dei contenuti collegati"
89
+
90
+#: core/widget.php:37
91
+msgid "Connection type:"
92
+msgstr "Tipo relazione:"
93
+
94
+#: core/widget.php:41
95
+msgid "Connection listing:"
96
+msgstr "Elenco relazioni:"
97
+
98
+#: core/widget.php:47
99
+msgid "connected"
100
+msgstr "connesso"
101
+
102
+#: core/widget.php:48
103
+msgid "related"
104
+msgstr "in relazione"
105
+
106
+#: core/widget.php:73
107
+msgid "Related %s"
108
+msgstr "In relazione %s"
109
+
110
+#: core/storage.php:35
111
+msgid "Upgraded %d connections."
112
+msgstr "Aggiornato %d relazioni"
113
+
114
+#: core/storage.php:38
115
+msgid "The Posts 2 Posts connections need to be upgraded. <a href=\"%s\">Proceed.</a>"
116
+msgstr "Posts 2 Posts ha un Upgrade. <a href=\"%s\">Procedi.</a>"
117
+
118
+#: core/side.php:110
119
+msgid "Users"
120
+msgstr "Utenti"
121
+
122
+#: core/side.php:115
123
+msgid "User"
124
+msgstr "Utente"
125
+
126
+#: core/side.php:116
127
+msgid "Search Users"
128
+msgstr "Cerca utenti"
129
+
130
+#: core/side.php:117
131
+msgid "No users found."
132
+msgstr "Nessun utente trovato."
133
+

BIN
plugins/posts-to-posts/lang/posts-to-posts-ja.mo Переглянути файл


+ 155
- 0
plugins/posts-to-posts/lang/posts-to-posts-ja.po Переглянути файл

@@ -0,0 +1,155 @@
1
+# Copyright (C) 2013 
2
+# This file is distributed under the same license as the  package.
3
+msgid ""
4
+msgstr ""
5
+"Project-Id-Version: ja\n"
6
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
7
+"POT-Creation-Date: 2013-02-17 08:06:11+00:00\n"
8
+"MIME-Version: 1.0\n"
9
+"Content-Type: text/plain; charset=UTF-8\n"
10
+"Content-Transfer-Encoding: 8bit\n"
11
+"PO-Revision-Date: 2013-04-13 22:05+0900\n"
12
+"Last-Translator: MIKI, Toru <toru@waviaei.com>\n"
13
+"Language-Team: ja <waviaei@gmail.com>\n"
14
+"X-Generator: Poedit 1.5.5\n"
15
+"Language: ja\n"
16
+
17
+#: admin/box.php:45
18
+msgid "Are you sure you want to delete all connections?"
19
+msgstr "全ての関連付けを削除してもよいですか?"
20
+
21
+#: admin/box.php:136
22
+msgid "Search"
23
+msgstr "検索"
24
+
25
+#: admin/box.php:213
26
+msgid "previous"
27
+msgstr "前へ"
28
+
29
+#: admin/box.php:214
30
+msgid "next"
31
+msgstr "次へ"
32
+
33
+#: admin/box.php:215
34
+msgid "of"
35
+msgstr " / "
36
+
37
+#: admin/dropdown-user.php:32
38
+msgid "Filter"
39
+msgstr "フィルター"
40
+
41
+#: admin/factory.php:88
42
+msgid " (from)"
43
+msgstr " (から)"
44
+
45
+#: admin/factory.php:89
46
+msgid " (to)"
47
+msgstr " (へ)"
48
+
49
+#: admin/field-delete.php:7
50
+msgid "Delete all connections"
51
+msgstr "全ての関連付けを削除"
52
+
53
+#: admin/field-delete.php:16
54
+msgid "Delete connection"
55
+msgstr "関連付けを削除"
56
+
57
+#: admin/tools-page.php:7
58
+msgid "Connection Types"
59
+msgstr "関連付け"
60
+
61
+#: admin/tools-page.php:41
62
+msgid "<em>%s</em> is not a registered connection type."
63
+msgstr "<em>%s</em> は登録された関連付けではありません。"
64
+
65
+#: admin/tools-page.php:50
66
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
67
+msgstr "<em>%2$s</em> から <em>%3$s</em> へ %1$s の関連付けを変換する。"
68
+
69
+#: admin/tools-page.php:64
70
+msgid "Name"
71
+msgstr "関連付けの名称"
72
+
73
+#: admin/tools-page.php:65
74
+msgid "Information"
75
+msgstr "内容"
76
+
77
+#: admin/tools-page.php:66
78
+msgid "Connections"
79
+msgstr "数"
80
+
81
+#: admin/tools-page.php:74
82
+msgid "No connection types registered."
83
+msgstr "関連付けは登録されていません。"
84
+
85
+#: admin/tools-page.php:76
86
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
87
+msgstr "関連付けの登録方法は <a href=\"%s\">wiki</a> をご覧ください。"
88
+
89
+#: admin/tools-page.php:93
90
+msgid "Convert to registered connection type:"
91
+msgstr "登録済みの関連付けに変換する:"
92
+
93
+#: admin/tools-page.php:129
94
+msgid "Go"
95
+msgstr "Go"
96
+
97
+#: core/connection-type.php:102
98
+msgid "Create connections"
99
+msgstr "関連付けを作成"
100
+
101
+#: core/connection-type.php:120
102
+msgid "Connected %s"
103
+msgstr "%s への関連付け"
104
+
105
+#: core/side-user.php:16
106
+msgid "Users"
107
+msgstr "ユーザー"
108
+
109
+#: core/side-user.php:25
110
+msgid "User"
111
+msgstr "ユーザー"
112
+
113
+#: core/side-user.php:26
114
+msgid "Search Users"
115
+msgstr "ユーザーを検索"
116
+
117
+#: core/side-user.php:27
118
+msgid "No users found."
119
+msgstr "ユーザーは見つかりませんでした。"
120
+
121
+#: core/widget.php:16
122
+msgid "Posts 2 Posts"
123
+msgstr "Posts 2 Posts"
124
+
125
+#: core/widget.php:17
126
+msgid "A list of posts connected to the current post"
127
+msgstr "この投稿に関連付けられた投稿一覧"
128
+
129
+#: core/widget.php:34
130
+msgid "Title:"
131
+msgstr "タイトル :"
132
+
133
+#: core/widget.php:41
134
+msgid "Connection type:"
135
+msgstr "関連付け:"
136
+
137
+#: core/widget.php:46
138
+msgid "Connection listing:"
139
+msgstr "表示するリスト:"
140
+
141
+#: core/widget.php:52
142
+msgid "connected"
143
+msgstr "関連付けられた投稿"
144
+
145
+#: core/widget.php:53
146
+msgid "related"
147
+msgstr "関係のある投稿"
148
+
149
+#: scb/AdminPage.php:227
150
+msgid "Settings <strong>saved</strong>."
151
+msgstr "設定を<strong>保存</strong>しました。"
152
+
153
+#: scb/AdminPage.php:466
154
+msgid "Settings"
155
+msgstr "設定"

BIN
plugins/posts-to-posts/lang/posts-to-posts-nl_NL.mo Переглянути файл


+ 155
- 0
plugins/posts-to-posts/lang/posts-to-posts-nl_NL.po Переглянути файл

@@ -0,0 +1,155 @@
1
+# Translation of 1.4.3-alpha in Dutch
2
+# This file is distributed under the same license as the 1.4.3-alpha package.
3
+msgid ""
4
+msgstr ""
5
+"PO-Revision-Date: 2012-09-19 09:35+0100\n"
6
+"MIME-Version: 1.0\n"
7
+"Content-Type: text/plain; charset=UTF-8\n"
8
+"Content-Transfer-Encoding: 8bit\n"
9
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
10
+"X-Generator: Poedit 1.5.3\n"
11
+"Project-Id-Version: 1.4.3-alpha\n"
12
+"POT-Creation-Date: \n"
13
+"Last-Translator: Remco Tolsma <remco@pronamic.nl>\n"
14
+"Language-Team: \n"
15
+
16
+#: admin/tools.php:7
17
+msgid "Connection Types"
18
+msgstr "Verbindingstypen"
19
+
20
+#: admin/tools.php:41
21
+msgid "<em>%s</em> is not a registered connection type."
22
+msgstr "<em>%s</em> is niet een geregistreerde verbindingstype."
23
+
24
+#: admin/tools.php:50
25
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
26
+msgstr "%1$s verbindingen omgezet van <em>%2$s</em> naar <em>%3$s</em>."
27
+
28
+#: admin/tools.php:64
29
+msgid "Name"
30
+msgstr "Naam"
31
+
32
+#: admin/tools.php:65
33
+msgid "Information"
34
+msgstr "Informatie"
35
+
36
+#: admin/tools.php:66
37
+msgid "Connections"
38
+msgstr "Verbindingen"
39
+
40
+#: admin/tools.php:74
41
+msgid "No connection types registered."
42
+msgstr "Geen verbindingstypen geregistreerd."
43
+
44
+#: admin/tools.php:76
45
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
46
+msgstr ""
47
+"Bekijk <a href=\"%s\">de wiki</a> om een verbindingstype te registeren."
48
+
49
+#: admin/tools.php:93
50
+msgid "Convert to registered connection type:"
51
+msgstr "Omzetten naar geregistreerde verbindingstype:"
52
+
53
+#: admin/tools.php:129
54
+msgid "Go"
55
+msgstr "Ga"
56
+
57
+#: admin/box.php:38
58
+msgid "Are you sure you want to delete all connections?"
59
+msgstr "Weet je zeker dat je alle verbindingen wilt verwijderen?"
60
+
61
+#: admin/box.php:114
62
+msgid "Search"
63
+msgstr "Zoeken"
64
+
65
+#: admin/box.php:191
66
+msgid "previous"
67
+msgstr "vorige"
68
+
69
+#: admin/box.php:192
70
+msgid "next"
71
+msgstr "volgende"
72
+
73
+#: admin/box.php:193
74
+msgid "of"
75
+msgstr "of"
76
+
77
+#: admin/factory.php:30
78
+msgid " (from)"
79
+msgstr "(van)"
80
+
81
+#: admin/factory.php:31
82
+msgid " (to)"
83
+msgstr "(naar)"
84
+
85
+#: admin/fields.php:7
86
+msgid "Delete all connections"
87
+msgstr "Verwijder alle verbindingen"
88
+
89
+#: admin/fields.php:16
90
+msgid "Delete connection"
91
+msgstr "Verwijder verbinding"
92
+
93
+#: core/type.php:85
94
+msgid "Create connections"
95
+msgstr "Verbindingen maken"
96
+
97
+#: core/type.php:108
98
+msgid "Connected %s"
99
+msgstr "Verbonden %s"
100
+
101
+#: core/side.php:224
102
+msgid "Users"
103
+msgstr "Gebruikers"
104
+
105
+#: core/side.php:233
106
+msgid "User"
107
+msgstr "Gebruiker"
108
+
109
+#: core/side.php:234
110
+msgid "Search Users"
111
+msgstr "Gebruikers zoeken"
112
+
113
+#: core/side.php:235
114
+msgid "No users found."
115
+msgstr "Geen gebruikers gevonden."
116
+
117
+#: core/extra.php:16
118
+msgid "Posts 2 Posts"
119
+msgstr "Posts 2 Posts"
120
+
121
+#: core/extra.php:17
122
+msgid "A list of posts connected to the current post"
123
+msgstr "Een lijst van berichten verbonden aan het huidige bericht."
124
+
125
+#: core/extra.php:34
126
+msgid "Title:"
127
+msgstr "Titel:"
128
+
129
+#: core/extra.php:41
130
+msgid "Connection type:"
131
+msgstr "Verbindingstype:"
132
+
133
+#: core/extra.php:46
134
+msgid "Connection listing:"
135
+msgstr "Verbindingslijst:"
136
+
137
+#: core/extra.php:52
138
+msgid "connected"
139
+msgstr "verbonden"
140
+
141
+#: core/extra.php:53
142
+msgid "related"
143
+msgstr "gerelateerd"
144
+
145
+#: scb/AdminPage.php:172
146
+msgid "Settings <strong>saved</strong>."
147
+msgstr "Instellingen <strong>opgeslagen</strong>."
148
+
149
+#: scb/AdminPage.php:185 scb/AdminPage.php:196
150
+msgid "Save Changes"
151
+msgstr "Wijzigingen opslaan"
152
+
153
+#: scb/AdminPage.php:346
154
+msgid "Settings"
155
+msgstr "Instellingen"

BIN
plugins/posts-to-posts/lang/posts-to-posts-pt_BR.mo Переглянути файл


+ 74
- 0
plugins/posts-to-posts/lang/posts-to-posts-pt_BR.po Переглянути файл

@@ -0,0 +1,74 @@
1
+# Copyright (C) 2010 
2
+# This file is distributed under the same license as the  package.
3
+msgid ""
4
+msgstr ""
5
+"Project-Id-Version: Posts 2 Posts 0.4\n"
6
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
7
+"POT-Creation-Date: 2011-07-22 13:03:03+00:00\n"
8
+"MIME-Version: 1.0\n"
9
+"Content-Type: text/plain; charset=UTF-8\n"
10
+"Content-Transfer-Encoding: 8bit\n"
11
+"PO-Revision-Date: 2011-08-31 17:26-0300\n"
12
+"Last-Translator: Marcelo Minholi <minholi@gmail.com>\n"
13
+"Language-Team: \n"
14
+"X-Poedit-Language: Portuguese\n"
15
+"X-Poedit-Country: BRAZIL\n"
16
+"X-Poedit-SourceCharset: utf-8\n"
17
+
18
+#: scb/AdminPage.php:161
19
+msgid "Settings <strong>saved</strong>."
20
+msgstr "Configurações <strong>salvas</strong>."
21
+
22
+#: scb/AdminPage.php:174
23
+#: scb/AdminPage.php:185
24
+msgid "Save Changes"
25
+msgstr "Salvar Alterações"
26
+
27
+#: scb/AdminPage.php:367
28
+msgid "Settings"
29
+msgstr "Configurações"
30
+
31
+#: ui/box.php:14
32
+msgid "Are you sure you want to delete all connections?"
33
+msgstr "Você tem certeza que quer apagar todas as relações?"
34
+
35
+#: ui/box.php:33
36
+msgid "Create connections:"
37
+msgstr "Criar relações:"
38
+
39
+#: ui/box.php:64
40
+msgid "Search"
41
+msgstr "Buscar"
42
+
43
+#: ui/box.php:72
44
+msgid "Recent"
45
+msgstr "Recentes"
46
+
47
+#: ui/box.php:148
48
+msgid "Previous"
49
+msgstr "Anteriores"
50
+
51
+#: ui/box.php:149
52
+msgid "Next"
53
+msgstr "Próximas"
54
+
55
+#: ui/box.php:150
56
+msgid "of"
57
+msgstr "de"
58
+
59
+#: ui/box.php:182
60
+msgid "Create connection"
61
+msgstr "Criar relação"
62
+
63
+#: ui/box.php:191
64
+msgid "Delete connection"
65
+msgstr "Apagar relação"
66
+
67
+#: ui/box.php:199
68
+msgid "Delete all connections"
69
+msgstr "Apagar todas as relações"
70
+
71
+#: ui.php:33
72
+msgid "Connected %s"
73
+msgstr "%s Relacionado(a)"
74
+

BIN
plugins/posts-to-posts/lang/posts-to-posts-ro_RO.mo Переглянути файл


+ 198
- 0
plugins/posts-to-posts/lang/posts-to-posts-ro_RO.po Переглянути файл

@@ -0,0 +1,198 @@
1
+# Translation of the WordPress plugin Posts 2 Posts 0.3 by scribu.
2
+# Copyright (C) 2010 scribu
3
+# This file is distributed under the same license as the Posts 2 Posts package.
4
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+#
6
+msgid ""
7
+msgstr ""
8
+"Project-Id-Version: Posts 2 Posts\n"
9
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
10
+"POT-Creation-Date: 2013-02-17 08:06:11+00:00\n"
11
+"PO-Revision-Date: 2013-02-17 10:07+0200\n"
12
+"Last-Translator: scribu <mail@scribu.net>\n"
13
+"Language-Team: ROMANIAN <LL@li.org>\n"
14
+"Language: \n"
15
+"MIME-Version: 1.0\n"
16
+"Content-Type: text/plain; charset=UTF-8\n"
17
+"Content-Transfer-Encoding: 8bit\n"
18
+
19
+#: admin/box.php:45
20
+msgid "Are you sure you want to delete all connections?"
21
+msgstr "Sigur vreți să ștergeți toate conexiunile?"
22
+
23
+#: admin/box.php:136
24
+msgid "Search"
25
+msgstr "Căutare"
26
+
27
+#: admin/box.php:213
28
+msgid "previous"
29
+msgstr "anterioare"
30
+
31
+#: admin/box.php:214
32
+msgid "next"
33
+msgstr "următoare"
34
+
35
+#: admin/box.php:215
36
+msgid "of"
37
+msgstr "din"
38
+
39
+#: admin/dropdown-user.php:32
40
+msgid "Filter"
41
+msgstr "Filtru"
42
+
43
+#: admin/factory.php:88
44
+msgid " (from)"
45
+msgstr "(de la)"
46
+
47
+#: admin/factory.php:89
48
+msgid " (to)"
49
+msgstr "(la)"
50
+
51
+#: admin/field-delete.php:7
52
+msgid "Delete all connections"
53
+msgstr "Șterge toate conexiunile"
54
+
55
+#: admin/field-delete.php:16
56
+msgid "Delete connection"
57
+msgstr "Șterge conexiune"
58
+
59
+#: admin/tools-page.php:7
60
+msgid "Connection Types"
61
+msgstr "Tipuri de conexiuni"
62
+
63
+#: admin/tools-page.php:41
64
+msgid "<em>%s</em> is not a registered connection type."
65
+msgstr "<em>%s</em> nu e un tip de conexiune înregistrat."
66
+
67
+#: admin/tools-page.php:50
68
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
69
+msgstr "Am convertit %1$s conexiuni din <em>%2$s</em> în <em>%3$s</em>."
70
+
71
+#: admin/tools-page.php:64
72
+msgid "Name"
73
+msgstr "Nume"
74
+
75
+#: admin/tools-page.php:65
76
+msgid "Information"
77
+msgstr "Informații"
78
+
79
+#: admin/tools-page.php:66
80
+msgid "Connections"
81
+msgstr "Conexiuni"
82
+
83
+#: admin/tools-page.php:74
84
+msgid "No connection types registered."
85
+msgstr "Nu există tipuri de conexiuni înregistrate."
86
+
87
+#: admin/tools-page.php:76
88
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
89
+msgstr "Pentru a înregistra un tip de conexiune, vezi <a href=\"%s\">wiki-ul</a>."
90
+
91
+#: admin/tools-page.php:93
92
+msgid "Convert to registered connection type:"
93
+msgstr "Convertește într-un tip de conexiune înregistrat:"
94
+
95
+#: admin/tools-page.php:129
96
+msgid "Go"
97
+msgstr "Go"
98
+
99
+#: core/connection-type.php:102
100
+msgid "Create connections"
101
+msgstr "Creează conexiuni"
102
+
103
+#: core/connection-type.php:120
104
+msgid "Connected %s"
105
+msgstr "%s conectate"
106
+
107
+#: core/side-user.php:16
108
+msgid "Users"
109
+msgstr "Utilizatori"
110
+
111
+#: core/side-user.php:25
112
+msgid "User"
113
+msgstr "Utilizator"
114
+
115
+#: core/side-user.php:26
116
+msgid "Search Users"
117
+msgstr "Caută utilizatori"
118
+
119
+#: core/side-user.php:27
120
+msgid "No users found."
121
+msgstr "Niciun utilizator găsit."
122
+
123
+#: core/widget.php:16
124
+msgid "Posts 2 Posts"
125
+msgstr "Posts 2 Posts"
126
+
127
+#: core/widget.php:17
128
+msgid "A list of posts connected to the current post"
129
+msgstr "O lista de postări conectate la postarea curentă"
130
+
131
+#: core/widget.php:34
132
+msgid "Title:"
133
+msgstr "Titlu:"
134
+
135
+#: core/widget.php:41
136
+msgid "Connection type:"
137
+msgstr "Tipul conexiunii:"
138
+
139
+#: core/widget.php:46
140
+msgid "Connection listing:"
141
+msgstr "Conexiuni de listat:"
142
+
143
+#: core/widget.php:52
144
+msgid "connected"
145
+msgstr "conectate"
146
+
147
+#: core/widget.php:53
148
+msgid "related"
149
+msgstr "înrudite"
150
+
151
+#: scb/AdminPage.php:227
152
+msgid "Settings <strong>saved</strong>."
153
+msgstr "Setări <strong>salvate</strong>."
154
+
155
+#: scb/AdminPage.php:466
156
+msgid "Settings"
157
+msgstr "Setări"
158
+
159
+#~ msgid "Can't create connection: %s"
160
+#~ msgstr "Conexiunea nu poate fi creată: %s"
161
+
162
+#~ msgid "Save Changes"
163
+#~ msgstr "Salvează schimbările"
164
+
165
+#~ msgid "View All"
166
+#~ msgstr "Vezi toate"
167
+
168
+#~ msgid "Create connection"
169
+#~ msgstr "Crează conexiune"
170
+
171
+#~ msgid "Upgraded %d connections."
172
+#~ msgstr "Am actualizat %d conexiuni."
173
+
174
+#~ msgid ""
175
+#~ "The Posts 2 Posts connections need to be upgraded. <a href=\"%s\">Proceed."
176
+#~ "</a>"
177
+#~ msgstr ""
178
+#~ "Conexiunile Posts 2 Posts trebuie actualizate. <a href=\"%s\">Pornește.</"
179
+#~ "a>"
180
+
181
+#~ msgid "Related %s"
182
+#~ msgstr "%s înrudite"
183
+
184
+#~ msgid "Recent"
185
+#~ msgstr "Recente"
186
+
187
+#~ msgid "Next"
188
+#~ msgstr "Următoare"
189
+
190
+#~ msgid ""
191
+#~ "Start typing the title of a post you want to connect and then click on to "
192
+#~ "connect it."
193
+#~ msgstr ""
194
+#~ "Începe să scrii titlul post-ului de conectat și apoi fă click pentru a-l "
195
+#~ "conecta."
196
+
197
+#~ msgid "Enter IDs of posts to connect, separated by commas."
198
+#~ msgstr "Intrdu ID-uri ale post-urilor de conectat, separate prin virgulă."

BIN
plugins/posts-to-posts/lang/posts-to-posts-ru_RU.mo Переглянути файл


+ 88
- 0
plugins/posts-to-posts/lang/posts-to-posts-ru_RU.po Переглянути файл

@@ -0,0 +1,88 @@
1
+msgid ""
2
+msgstr ""
3
+"Project-Id-Version: Posts-to-posts\n"
4
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
5
+"POT-Creation-Date: 2011-09-24 13:12:56+00:00\n"
6
+"PO-Revision-Date: \n"
7
+"Last-Translator: foralien <nordworldofann@gmail.com>\n"
8
+"Language-Team: foalien\n"
9
+"MIME-Version: 1.0\n"
10
+"Content-Type: text/plain; charset=UTF-8\n"
11
+"Content-Transfer-Encoding: 8bit\n"
12
+
13
+#: scb/AdminPage.php:163
14
+msgid "Settings <strong>saved</strong>."
15
+msgstr "Настройки <strong>сохранены</strong>."
16
+
17
+#: scb/AdminPage.php:176
18
+#: scb/AdminPage.php:187
19
+msgid "Save Changes"
20
+msgstr "Сохранить изменения"
21
+
22
+#: scb/AdminPage.php:348
23
+msgid "Settings"
24
+msgstr "Настройки"
25
+
26
+#: admin/fields.php:13
27
+msgid "Create connection"
28
+msgstr "Создать взаимосвязь"
29
+
30
+#: admin/fields.php:25
31
+msgid "Delete all connections"
32
+msgstr "Удалить все взаимосвязи"
33
+
34
+#: admin/fields.php:34
35
+msgid "Delete connection"
36
+msgstr "Удалить взаимосвязь"
37
+
38
+#: admin/box.php:59
39
+msgid "Are you sure you want to delete all connections?"
40
+msgstr "Вы уверены, что хотите удалить все взаимосвязи?"
41
+
42
+#: admin/box.php:69
43
+msgid "Connected %s"
44
+msgstr "Связанные %s"
45
+
46
+#: admin/box.php:116
47
+msgid "Create connections:"
48
+msgstr "Создать взаимосвязи:"
49
+
50
+#: admin/box.php:125
51
+msgid "Search"
52
+msgstr "Поиск"
53
+
54
+#: admin/box.php:133
55
+msgid "View All"
56
+msgstr "Все"
57
+
58
+#: admin/box.php:216
59
+msgid "previous"
60
+msgstr "пред."
61
+
62
+#: admin/box.php:217
63
+msgid "next"
64
+msgstr "след."
65
+
66
+#: admin/box.php:218
67
+msgid "of"
68
+msgstr "из"
69
+
70
+#: core/widget.php:14
71
+msgid "Posts 2 Posts"
72
+msgstr "Posts 2 Posts"
73
+
74
+#: core/widget.php:15
75
+msgid "A list of posts connected to the current post"
76
+msgstr "Список всех записей, связанных с текущей"
77
+
78
+#: core/widget.php:29
79
+msgid "Connection type:"
80
+msgstr "Тип взаимосвязи:"
81
+
82
+#: core/widget.php:53
83
+msgid "Related %s"
84
+msgstr "Связанные %s"
85
+
86
+#~ msgid "Recent"
87
+#~ msgstr "Недавние"
88
+

BIN
plugins/posts-to-posts/lang/posts-to-posts-sr_RS.mo Переглянути файл


+ 190
- 0
plugins/posts-to-posts/lang/posts-to-posts-sr_RS.po Переглянути файл

@@ -0,0 +1,190 @@
1
+# Translation of the WordPress plugin Posts 2 Posts by scribu.
2
+# Copyright (C) 2012
3
+# This file is distributed under the same license as the Posts 2 Posts package.
4
+msgid ""
5
+msgstr ""
6
+"Project-Id-Version: Posts 2 Posts\n"
7
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
8
+"POT-Creation-Date: 2011-12-01 16:28:04+00:00\n"
9
+"PO-Revision-Date: 2014-01-09 13:46+0100\n"
10
+"Last-Translator: Borisa Djuraskovic <borisad@webhostinghub.com>\n"
11
+"Language-Team: \n"
12
+"Language: Serbian\n"
13
+"MIME-Version: 1.0\n"
14
+"Content-Type: text/plain; charset=UTF-8\n"
15
+"Content-Transfer-Encoding: 8bit\n"
16
+"X-Generator: Poedit 1.5.7\n"
17
+
18
+#: admin/box.php:38
19
+msgid "Are you sure you want to delete all connections?"
20
+msgstr "Da li ste sigurni da želite da izbrišete sve konekcije?"
21
+
22
+#: admin/box.php:114
23
+msgid "Search"
24
+msgstr "Pretraga"
25
+
26
+#: admin/box.php:191
27
+msgid "previous"
28
+msgstr "prethodno"
29
+
30
+#: admin/box.php:192
31
+msgid "next"
32
+msgstr "sledeće"
33
+
34
+#: admin/box.php:193
35
+msgid "of"
36
+msgstr "od"
37
+
38
+#: admin/box.php:236
39
+msgid "Can't create connection: %s"
40
+msgstr "Ne može se povezati sa: %s"
41
+
42
+#: admin/factory.php:30
43
+msgid " (from)"
44
+msgstr "(od)"
45
+
46
+#: admin/factory.php:31
47
+msgid " (to)"
48
+msgstr "(za)"
49
+
50
+#: admin/fields.php:30
51
+msgid "Delete all connections"
52
+msgstr "Obrisati sve konekcije"
53
+
54
+#: admin/fields.php:39
55
+msgid "Delete connection"
56
+msgstr "Obrisati konekciju"
57
+
58
+#: admin/tools.php:7
59
+msgid "Connection Types"
60
+msgstr "Tipovi konekcija"
61
+
62
+#: admin/tools.php:41
63
+#, php-format
64
+msgid "<em>%s</em> is not a registered connection type."
65
+msgstr "<em>%s</em>nije registrovan tip konekcije."
66
+
67
+#: admin/tools.php:50
68
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
69
+msgstr "Konvertovano %1$s konekcija od<em>%2$s</em>do<em>%3$s</em>."
70
+
71
+#: admin/tools.php:64
72
+msgid "Name"
73
+msgstr "Ime"
74
+
75
+#: admin/tools.php:65
76
+msgid "Information"
77
+msgstr "Informacija"
78
+
79
+#: admin/tools.php:66
80
+msgid "Connections"
81
+msgstr "Konekcije"
82
+
83
+#: admin/tools.php:74
84
+msgid "No connection types registered."
85
+msgstr "Nijedan tip konekcija nije registrovan."
86
+
87
+#: admin/tools.php:76
88
+#, php-format
89
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
90
+msgstr ""
91
+"Da biste registrovali tip konekcije, pogledajte<a href=\"%s\">the wiki</a>."
92
+
93
+#: admin/tools.php:93
94
+msgid "Convert to registered connection type:"
95
+msgstr "Konvertuj na registrovani tip konekcije:"
96
+
97
+#: admin/tools.php:129
98
+msgid "Go"
99
+msgstr "Kreni"
100
+
101
+#: core/widget.php:15
102
+msgid "Posts 2 Posts"
103
+msgstr "Posts 2 Posts"
104
+
105
+#: core/widget.php:16
106
+msgid "A list of posts connected to the current post"
107
+msgstr "Lista postova konektovanih sa trenutnim postom"
108
+
109
+#: core/extra.php:34
110
+msgid "Title:"
111
+msgstr "Naslov:"
112
+
113
+#: admin/box.php:115
114
+msgid "Create connections:"
115
+msgstr "Kreiraj konekcije:"
116
+
117
+#: core/type.php:79
118
+msgid "Create connections"
119
+msgstr "Kreiraj konekcije"
120
+
121
+#: admin/box.php:136
122
+msgid "View All"
123
+msgstr "Pregledaj sve"
124
+
125
+#: admin/fields.php:16
126
+msgid "Create connection"
127
+msgstr "Napraviti konekciju"
128
+
129
+#: scb/AdminPage.php:165
130
+msgid "Settings <strong>saved</strong>."
131
+msgstr "Postavke<strong> sačuvane</strong>."
132
+
133
+#: scb/AdminPage.php:178 scb/AdminPage.php:189
134
+msgid "Save Changes"
135
+msgstr "Sačuvaj promene"
136
+
137
+#: scb/AdminPage.php:350
138
+msgid "Settings"
139
+msgstr "Postavke"
140
+
141
+#: core/type.php:65
142
+msgid "Connected %s"
143
+msgstr "Konektovano  %s"
144
+
145
+#: core/widget.php:37
146
+msgid "Connection type:"
147
+msgstr "Tip konekcija:"
148
+
149
+#: core/widget.php:41
150
+msgid "Connection listing:"
151
+msgstr "Listing konekcija:"
152
+
153
+#: core/widget.php:47
154
+msgid "connected"
155
+msgstr "konektovano"
156
+
157
+#: core/widget.php:48
158
+msgid "related"
159
+msgstr "vezano za"
160
+
161
+#: core/widget.php:73
162
+msgid "Related %s"
163
+msgstr "Vezano za %s"
164
+
165
+#: core/storage.php:35
166
+msgid "Upgraded %d connections."
167
+msgstr "Upgrade-ovano %d konekcija"
168
+
169
+#: core/storage.php:38
170
+msgid ""
171
+"The Posts 2 Posts connections need to be upgraded. <a href=\"%s\">Proceed.</"
172
+"a>"
173
+msgstr ""
174
+" Posts 2 Posts konekcije treba da se upgrade-uju.<a href=\"%s\"> Nastavi.</a>"
175
+
176
+#: core/side.php:110
177
+msgid "Users"
178
+msgstr "Korisnici"
179
+
180
+#: core/side.php:115
181
+msgid "User"
182
+msgstr "Korisnik"
183
+
184
+#: core/side.php:116
185
+msgid "Search Users"
186
+msgstr "Pretraga korisnika"
187
+
188
+#: core/side.php:117
189
+msgid "No users found."
190
+msgstr "Nijedan korisnik nije pronadjen"

BIN
plugins/posts-to-posts/lang/posts-to-posts-sv_SE.mo Переглянути файл


+ 165
- 0
plugins/posts-to-posts/lang/posts-to-posts-sv_SE.po Переглянути файл

@@ -0,0 +1,165 @@
1
+# Copyright (C) 2010 
2
+# This file is distributed under the same license as the  package.
3
+msgid ""
4
+msgstr ""
5
+"Project-Id-Version: Posts 2 Posts sv_SE\n"
6
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
7
+"POT-Creation-Date: 2013-02-17 08:06:11+00:00\n"
8
+"PO-Revision-Date: 2014-04-10 12:33+0100\n"
9
+"Last-Translator: Mattias Tengblad <mst@eyesx.com>\n"
10
+"Language-Team: WordPress Sverige <info@wpsv.se>\n"
11
+"Language: sv_SE\n"
12
+"MIME-Version: 1.0\n"
13
+"Content-Type: text/plain; charset=UTF-8\n"
14
+"Content-Transfer-Encoding: 8bit\n"
15
+"X-Poedit-SourceCharset: UTF-8\n"
16
+"X-Generator: Poedit 1.6.4\n"
17
+
18
+#: admin/box.php:45
19
+msgid "Are you sure you want to delete all connections?"
20
+msgstr "Är du säker på att du vill radera alla kopplingar?"
21
+
22
+#: admin/box.php:136
23
+msgid "Search"
24
+msgstr "Sök"
25
+
26
+#: admin/box.php:213
27
+msgid "previous"
28
+msgstr "föregående"
29
+
30
+#: admin/box.php:214
31
+msgid "next"
32
+msgstr "nästa"
33
+
34
+#: admin/box.php:215
35
+msgid "of"
36
+msgstr "av"
37
+
38
+#: admin/dropdown-user.php:32
39
+msgid "Filter"
40
+msgstr "Filtrera"
41
+
42
+#: admin/factory.php:88
43
+msgid " (from)"
44
+msgstr "(från)"
45
+
46
+#: admin/factory.php:89
47
+msgid " (to)"
48
+msgstr " (till)"
49
+
50
+#: admin/field-delete.php:7
51
+msgid "Delete all connections"
52
+msgstr "Radera alla kopplingar"
53
+
54
+#: admin/field-delete.php:16
55
+msgid "Delete connection"
56
+msgstr "Radera koppling"
57
+
58
+#: admin/tools-page.php:7
59
+msgid "Connection Types"
60
+msgstr "Kopplingstyper"
61
+
62
+#: admin/tools-page.php:41
63
+msgid "<em>%s</em> is not a registered connection type."
64
+msgstr "<em>%s</em> är inte en registrerad kopplingstyp."
65
+
66
+#: admin/tools-page.php:50
67
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
68
+msgstr "Konverterade %1$s kopplingar från <em>%2$s</em> till <em>%3$s</em>."
69
+
70
+#: admin/tools-page.php:64
71
+msgid "Name"
72
+msgstr "Namn"
73
+
74
+#: admin/tools-page.php:65
75
+msgid "Information"
76
+msgstr "Information"
77
+
78
+#: admin/tools-page.php:66
79
+msgid "Connections"
80
+msgstr "Kopplingar"
81
+
82
+#: admin/tools-page.php:74
83
+msgid "No connection types registered."
84
+msgstr "Inga kopplingstyper registrerade."
85
+
86
+#: admin/tools-page.php:76
87
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
88
+msgstr "För att registrera en kopplingstyp, se <a href=\"%s\">wikin</a>."
89
+
90
+#: admin/tools-page.php:93
91
+msgid "Convert to registered connection type:"
92
+msgstr "Konvertera till registrerad kopplingstyp:"
93
+
94
+#: admin/tools-page.php:129
95
+msgid "Go"
96
+msgstr "Ok"
97
+
98
+#: core/connection-type.php:102
99
+msgid "Create connections"
100
+msgstr "Skapa kopplingar"
101
+
102
+#: core/connection-type.php:120
103
+msgid "Connected %s"
104
+msgstr "Kopplad till %s"
105
+
106
+#: core/side-user.php:16
107
+msgid "Users"
108
+msgstr "Användare"
109
+
110
+#: core/side-user.php:25
111
+msgid "User"
112
+msgstr "Användare"
113
+
114
+#: core/side-user.php:26
115
+msgid "Search Users"
116
+msgstr "Sök efter användare"
117
+
118
+#: core/side-user.php:27
119
+msgid "No users found."
120
+msgstr "Inga användare funna."
121
+
122
+#: core/widget.php:16
123
+msgid "Posts 2 Posts"
124
+msgstr "Posts 2 Posts"
125
+
126
+#: core/widget.php:17
127
+msgid "A list of posts connected to the current post"
128
+msgstr "En lista över inlägg kopplade till aktuellt inlägg"
129
+
130
+#: core/widget.php:34
131
+msgid "Title:"
132
+msgstr "Titel:"
133
+
134
+#: core/widget.php:41
135
+msgid "Connection type:"
136
+msgstr "Kopplingstyp: "
137
+
138
+#: core/widget.php:46
139
+msgid "Connection listing:"
140
+msgstr "Kopplingslistning:"
141
+
142
+#: core/widget.php:52
143
+msgid "connected"
144
+msgstr "kopplad"
145
+
146
+#: core/widget.php:53
147
+msgid "related"
148
+msgstr "relaterad"
149
+
150
+#: scb/AdminPage.php:227
151
+msgid "Settings <strong>saved</strong>."
152
+msgstr "Inställningar <strong>sparade</strong>."
153
+
154
+#: scb/AdminPage.php:466
155
+msgid "Settings"
156
+msgstr "Inställningar"
157
+
158
+#~ msgid "Save Changes"
159
+#~ msgstr "Spara ändringar"
160
+
161
+#~ msgid "Create connection"
162
+#~ msgstr "Skapa koppling"
163
+
164
+#~ msgid "View All"
165
+#~ msgstr "Visa alla"

BIN
plugins/posts-to-posts/lang/posts-to-posts-tr_TR.mo Переглянути файл


+ 114
- 0
plugins/posts-to-posts/lang/posts-to-posts-tr_TR.po Переглянути файл

@@ -0,0 +1,114 @@
1
+# Translation of the WordPress plugin Posts 2 Posts 1.1.4 by scribu.
2
+# Copyright (C) 2011 scribu
3
+# This file is distributed under the same license as the Posts 2 Posts package.
4
+# ÖNDER CEYLAN <ondercey@yahoo.com>, 2011.
5
+#
6
+msgid ""
7
+msgstr ""
8
+"Project-Id-Version: Posts 2 Posts 1.1.4\n"
9
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/posts-to-posts\n"
10
+"POT-Creation-Date: 2011-03-30 21:56+0300\n"
11
+"PO-Revision-Date: 2012-01-23 00:54+0200\n"
12
+"Last-Translator: \n"
13
+"Language-Team: \n"
14
+"Language: \n"
15
+"MIME-Version: 1.0\n"
16
+"Content-Type: text/plain; charset=UTF-8\n"
17
+"Content-Transfer-Encoding: 8bit\n"
18
+
19
+#: admin/box.php:42
20
+msgid "Are you sure you want to delete all connections?"
21
+msgstr "Tüm bağlantıları kaldırmak istediğinizden emin misiniz?"
22
+
23
+#: admin/box.php:120
24
+msgid "Create connections:"
25
+msgstr "Bağlantı yarat:"
26
+
27
+#: admin/box.php:133
28
+msgid "Search"
29
+msgstr "Ara"
30
+
31
+#: admin/box.php:141
32
+msgid "View All"
33
+msgstr "Tümünü Listele"
34
+
35
+#: admin/box.php:209
36
+msgid "previous"
37
+msgstr "önceki"
38
+
39
+#: admin/box.php:210
40
+msgid "next"
41
+msgstr "sonraki"
42
+
43
+#: admin/box.php:211
44
+msgid "of"
45
+msgstr "arasından"
46
+
47
+#: admin/fields.php:14
48
+msgid "Create connection"
49
+msgstr "Bağlantı ekle"
50
+
51
+#: admin/fields.php:27
52
+msgid "Delete all connections"
53
+msgstr "Tüm bağlantıları kaldır"
54
+
55
+#: admin/fields.php:36
56
+msgid "Delete connection"
57
+msgstr "Bağlantıyı kaldır"
58
+
59
+#: core/side.php:141
60
+msgid "Users"
61
+msgstr "Kullanıcılar"
62
+
63
+#: core/side.php:146
64
+msgid "User"
65
+msgstr "Kullanıcı"
66
+
67
+#: core/side.php:147
68
+msgid "Search Users"
69
+msgstr "Kullanıcı Ara"
70
+
71
+#: core/side.php:148
72
+msgid "No users found."
73
+msgstr "Kullanıcı bulunamadı."
74
+
75
+#: core/storage.php:35
76
+msgid "Upgraded %d connections."
77
+msgstr "%d bağlantı güncellendi."
78
+
79
+#: core/storage.php:38
80
+msgid "The Posts 2 Posts connections need to be upgraded. <a href='%s'>Proceed.</a>"
81
+msgstr "Posts 2 Posts bağlantılarının güncellenmesi gerekiyor. <a href='%s'>Devam et.</a>"
82
+
83
+#: core/type.php:73
84
+msgid "Connected %s"
85
+msgstr "%s Bağlandı"
86
+
87
+#: core/widget.php:15
88
+msgid "Posts 2 Posts"
89
+msgstr "Posts 2 Posts"
90
+
91
+#: core/widget.php:16
92
+msgid "A list of posts connected to the current post"
93
+msgstr "Mevcut sayfayla bağlantılı sayfalar"
94
+
95
+#: core/widget.php:37
96
+msgid "Connection type:"
97
+msgstr "Bağlantı türü:"
98
+
99
+#: core/widget.php:41
100
+msgid "Connection listing:"
101
+msgstr "Bağlantı listesi:"
102
+
103
+#: core/widget.php:47
104
+msgid "connected"
105
+msgstr "bağlı"
106
+
107
+#: core/widget.php:48
108
+msgid "related"
109
+msgstr "benzer"
110
+
111
+#: core/widget.php:73
112
+msgid "Related %s"
113
+msgstr "Benzer %s"
114
+

BIN
plugins/posts-to-posts/lang/posts-to-posts-zh_CN.mo Переглянути файл


+ 155
- 0
plugins/posts-to-posts/lang/posts-to-posts-zh_CN.po Переглянути файл

@@ -0,0 +1,155 @@
1
+msgid ""
2
+msgstr ""
3
+"Project-Id-Version: Posts 2 Posts\n"
4
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
5
+"POT-Creation-Date: 2013-02-17 08:06:11+00:00\n"
6
+"PO-Revision-Date: \n"
7
+"Last-Translator: Daniel Koskinen <daniel.koskinen@gmail.com>\n"
8
+"Language-Team: Amos Lee <4626395@gmail.com>\n"
9
+"MIME-Version: 1.0\n"
10
+"Content-Type: text/plain; charset=UTF-8\n"
11
+"Content-Transfer-Encoding: 8bit\n"
12
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+"X-Poedit-SourceCharset: UTF-8\n"
14
+"Language: zh_CN\n"
15
+"X-Generator: Poedit 1.7.5\n"
16
+
17
+#: admin/box.php:45
18
+msgid "Are you sure you want to delete all connections?"
19
+msgstr "确定要删除所有连接吗?"
20
+
21
+#: admin/box.php:136
22
+msgid "Search"
23
+msgstr "搜索."
24
+
25
+#: admin/box.php:213
26
+msgid "previous"
27
+msgstr "上一个"
28
+
29
+#: admin/box.php:214
30
+msgid "next"
31
+msgstr "下一个"
32
+
33
+#: admin/box.php:215
34
+msgid "of"
35
+msgstr "/"
36
+
37
+#: admin/dropdown-user.php:32
38
+msgid "Filter"
39
+msgstr "筛选"
40
+
41
+#: admin/factory.php:88
42
+msgid " (from)"
43
+msgstr "从"
44
+
45
+#: admin/factory.php:89
46
+msgid " (to)"
47
+msgstr "到"
48
+
49
+#: admin/field-delete.php:7
50
+msgid "Delete all connections"
51
+msgstr "删除所有连接"
52
+
53
+#: admin/field-delete.php:16
54
+msgid "Delete connection"
55
+msgstr "删除连接"
56
+
57
+#: admin/tools-page.php:7
58
+msgid "Connection Types"
59
+msgstr "连接类型"
60
+
61
+#: admin/tools-page.php:41
62
+msgid "<em>%s</em> is not a registered connection type."
63
+msgstr "<em>%s</em> 不是一个注册的连接类型"
64
+
65
+#: admin/tools-page.php:50
66
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
67
+msgstr "从 <em>%2$s</em> 到 <em>%3$s</em>转换了 %1$s 个连接"
68
+
69
+#: admin/tools-page.php:64
70
+msgid "Name"
71
+msgstr "名称"
72
+
73
+#: admin/tools-page.php:65
74
+msgid "Information"
75
+msgstr "信息"
76
+
77
+#: admin/tools-page.php:66
78
+msgid "Connections"
79
+msgstr "连接"
80
+
81
+#: admin/tools-page.php:74
82
+msgid "No connection types registered."
83
+msgstr "没有注册连接类型"
84
+
85
+#: admin/tools-page.php:76
86
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
87
+msgstr "需要注册连接类型,查看 <a href=\"%s\">wiki</a>."
88
+
89
+#: admin/tools-page.php:93
90
+msgid "Convert to registered connection type:"
91
+msgstr "转换到已注册的连接类型:"
92
+
93
+#: admin/tools-page.php:129
94
+msgid "Go"
95
+msgstr "转到"
96
+
97
+#: core/connection-type.php:102
98
+msgid "Create connections"
99
+msgstr "创建连接"
100
+
101
+#: core/connection-type.php:120
102
+msgid "Connected %s"
103
+msgstr "%s 已连接"
104
+
105
+#: core/side-user.php:16
106
+msgid "Users"
107
+msgstr "用户"
108
+
109
+#: core/side-user.php:25
110
+msgid "User"
111
+msgstr "用户"
112
+
113
+#: core/side-user.php:26
114
+msgid "Search Users"
115
+msgstr "搜索用户"
116
+
117
+#: core/side-user.php:27
118
+msgid "No users found."
119
+msgstr "没有找到用户"
120
+
121
+#: core/widget.php:16
122
+msgid "Posts 2 Posts"
123
+msgstr "Posts 2 Posts"
124
+
125
+#: core/widget.php:17
126
+msgid "A list of posts connected to the current post"
127
+msgstr "连接到本文的文章"
128
+
129
+#: core/widget.php:34
130
+msgid "Title:"
131
+msgstr "标题:"
132
+
133
+#: core/widget.php:41
134
+msgid "Connection type:"
135
+msgstr "连接类型:"
136
+
137
+#: core/widget.php:46
138
+msgid "Connection listing:"
139
+msgstr "连接列表:"
140
+
141
+#: core/widget.php:52
142
+msgid "connected"
143
+msgstr "已连接"
144
+
145
+#: core/widget.php:53
146
+msgid "related"
147
+msgstr "相关"
148
+
149
+#: scb/AdminPage.php:227
150
+msgid "Settings <strong>saved</strong>."
151
+msgstr "设置 <strong>已保存</strong>."
152
+
153
+#: scb/AdminPage.php:466
154
+msgid "Settings"
155
+msgstr "设置"

+ 153
- 0
plugins/posts-to-posts/lang/posts-to-posts.pot Переглянути файл

@@ -0,0 +1,153 @@
1
+# Copyright (C) 2013 
2
+# This file is distributed under the same license as the  package.
3
+msgid ""
4
+msgstr ""
5
+"Project-Id-Version:  \n"
6
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/p2p\n"
7
+"POT-Creation-Date: 2013-02-17 08:06:11+00:00\n"
8
+"MIME-Version: 1.0\n"
9
+"Content-Type: text/plain; charset=UTF-8\n"
10
+"Content-Transfer-Encoding: 8bit\n"
11
+"PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+"Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+#: admin/box.php:45
16
+msgid "Are you sure you want to delete all connections?"
17
+msgstr ""
18
+
19
+#: admin/box.php:136
20
+msgid "Search"
21
+msgstr ""
22
+
23
+#: admin/box.php:213
24
+msgid "previous"
25
+msgstr ""
26
+
27
+#: admin/box.php:214
28
+msgid "next"
29
+msgstr ""
30
+
31
+#: admin/box.php:215
32
+msgid "of"
33
+msgstr ""
34
+
35
+#: admin/dropdown-user.php:32
36
+msgid "Filter"
37
+msgstr ""
38
+
39
+#: admin/factory.php:88
40
+msgid " (from)"
41
+msgstr ""
42
+
43
+#: admin/factory.php:89
44
+msgid " (to)"
45
+msgstr ""
46
+
47
+#: admin/field-delete.php:7
48
+msgid "Delete all connections"
49
+msgstr ""
50
+
51
+#: admin/field-delete.php:16
52
+msgid "Delete connection"
53
+msgstr ""
54
+
55
+#: admin/tools-page.php:7
56
+msgid "Connection Types"
57
+msgstr ""
58
+
59
+#: admin/tools-page.php:41
60
+msgid "<em>%s</em> is not a registered connection type."
61
+msgstr ""
62
+
63
+#: admin/tools-page.php:50
64
+msgid "Converted %1$s connections from <em>%2$s</em> to <em>%3$s</em>."
65
+msgstr ""
66
+
67
+#: admin/tools-page.php:64
68
+msgid "Name"
69
+msgstr ""
70
+
71
+#: admin/tools-page.php:65
72
+msgid "Information"
73
+msgstr ""
74
+
75
+#: admin/tools-page.php:66
76
+msgid "Connections"
77
+msgstr ""
78
+
79
+#: admin/tools-page.php:74
80
+msgid "No connection types registered."
81
+msgstr ""
82
+
83
+#: admin/tools-page.php:76
84
+msgid "To register a connection type, see <a href=\"%s\">the wiki</a>."
85
+msgstr ""
86
+
87
+#: admin/tools-page.php:93
88
+msgid "Convert to registered connection type:"
89
+msgstr ""
90
+
91
+#: admin/tools-page.php:129
92
+msgid "Go"
93
+msgstr ""
94
+
95
+#: core/connection-type.php:102
96
+msgid "Create connections"
97
+msgstr ""
98
+
99
+#: core/connection-type.php:120
100
+msgid "Connected %s"
101
+msgstr ""
102
+
103
+#: core/side-user.php:16
104
+msgid "Users"
105
+msgstr ""
106
+
107
+#: core/side-user.php:25
108
+msgid "User"
109
+msgstr ""
110
+
111
+#: core/side-user.php:26
112
+msgid "Search Users"
113
+msgstr ""
114
+
115
+#: core/side-user.php:27
116
+msgid "No users found."
117
+msgstr ""
118
+
119
+#: core/widget.php:16
120
+msgid "Posts 2 Posts"
121
+msgstr ""
122
+
123
+#: core/widget.php:17
124
+msgid "A list of posts connected to the current post"
125
+msgstr ""
126
+
127
+#: core/widget.php:34
128
+msgid "Title:"
129
+msgstr ""
130
+
131
+#: core/widget.php:41
132
+msgid "Connection type:"
133
+msgstr ""
134
+
135
+#: core/widget.php:46
136
+msgid "Connection listing:"
137
+msgstr ""
138
+
139
+#: core/widget.php:52
140
+msgid "connected"
141
+msgstr ""
142
+
143
+#: core/widget.php:53
144
+msgid "related"
145
+msgstr ""
146
+
147
+#: scb/AdminPage.php:227
148
+msgid "Settings <strong>saved</strong>."
149
+msgstr ""
150
+
151
+#: scb/AdminPage.php:466
152
+msgid "Settings"
153
+msgstr ""

+ 70
- 0
plugins/posts-to-posts/posts-to-posts.php Переглянути файл

@@ -0,0 +1,70 @@
1
+<?php
2
+/*
3
+Plugin Name: Posts 2 Posts
4
+Description: Create many-to-many relationships between all types of posts.
5
+Version: 1.6.5
6
+Author: scribu
7
+Author URI: http://scribu.net/
8
+Plugin URI: http://scribu.net/wordpress/posts-to-posts
9
+Text Domain: posts-to-posts
10
+Domain Path: /lang
11
+*/
12
+
13
+define( 'P2P_PLUGIN_VERSION', '1.6.5' );
14
+
15
+define( 'P2P_TEXTDOMAIN', 'posts-to-posts' );
16
+
17
+function _p2p_load() {
18
+	load_plugin_textdomain( P2P_TEXTDOMAIN, '', basename( dirname( __FILE__ ) ) . '/lang' );
19
+
20
+	if ( !function_exists( 'p2p_register_connection_type' ) ) {
21
+		require_once dirname( __FILE__ ) . '/vendor/scribu/lib-posts-to-posts/autoload.php';
22
+	}
23
+
24
+	P2P_Storage::init();
25
+
26
+	P2P_Query_Post::init();
27
+	P2P_Query_User::init();
28
+
29
+	P2P_URL_Query::init();
30
+
31
+	P2P_Widget::init();
32
+	P2P_Shortcodes::init();
33
+
34
+	register_uninstall_hook( __FILE__, array( 'P2P_Storage', 'uninstall' ) );
35
+
36
+	if ( is_admin() )
37
+		_p2p_load_admin();
38
+}
39
+
40
+function _p2p_load_admin() {
41
+	P2P_Autoload::register( 'P2P_', dirname( __FILE__ ) . '/admin' );
42
+
43
+	P2P_Mustache::init();
44
+
45
+	new P2P_Box_Factory;
46
+	new P2P_Column_Factory;
47
+	new P2P_Dropdown_Factory;
48
+
49
+	new P2P_Tools_Page;
50
+}
51
+
52
+function _p2p_init() {
53
+	// Safe hook for calling p2p_register_connection_type()
54
+	do_action( 'p2p_init' );
55
+}
56
+
57
+if ( is_dir( dirname( __FILE__ ) . '/vendor' ) ) {
58
+	// Not using vendor/autload.php because scb-framework/load.php has better compatibility
59
+
60
+	if (!class_exists('Mustache_Autoloader')) {
61
+		require_once dirname( __FILE__ ) . '/vendor/mustache/mustache/src/Mustache/Autoloader.php';
62
+		Mustache_Autoloader::register();
63
+	}
64
+
65
+	require_once dirname( __FILE__ ) . '/vendor/scribu/scb-framework/load.php';
66
+}
67
+
68
+scb_init( '_p2p_load' );
69
+add_action( 'wp_loaded', '_p2p_init' );
70
+

+ 309
- 0
plugins/posts-to-posts/readme.txt Переглянути файл

@@ -0,0 +1,309 @@
1
+=== Posts 2 Posts ===
2
+
3
+Contributors: scribu, ciobi  
4
+Tags: connections, custom post types, relationships, many-to-many, users  
5
+Requires at least: 3.9  
6
+Tested up to: 4.3  
7
+Stable tag: 1.6.5  
8
+License: GPLv2 or later  
9
+License URI: http://www.gnu.org/licenses/gpl-2.0.html  
10
+
11
+Efficient many-to-many connections between posts, pages, custom post types, users.
12
+
13
+== Description ==
14
+
15
+This plugin allows you to create many-to-many relationships between posts of any type: post, page, custom etc. A few example use cases:
16
+
17
+* manually curated lists of related posts
18
+* post series
19
+* products connected to retailers
20
+* etc.
21
+
22
+Additionally, you can create many-to-many relationships between posts and users. So, you could also implement:
23
+
24
+* favorite posts of users
25
+* multiple authors per post
26
+* etc.
27
+
28
+= Support & Maintenance =
29
+
30
+I, scribu, will not be offering support (either free or paid) for this plugin anymore.
31
+
32
+If you want to help maintain the plugin, fork it [on github](https://github.com/scribu/wp-posts-to-posts) and open pull requests.
33
+
34
+Links: [**Documentation**](http://github.com/scribu/wp-posts-to-posts/wiki) | [Plugin News](http://scribu.net/wordpress/posts-to-posts) | [Author's Site](http://scribu.net)
35
+
36
+== Installation ==
37
+
38
+See [Installing Plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins).
39
+
40
+After activating it, refer to the [Basic usage](https://github.com/scribu/wp-posts-to-posts/wiki/Basic-usage) tutorial.
41
+ 
42
+Additional info can be found on the [wiki](http://github.com/scribu/wp-posts-to-posts/wiki).
43
+
44
+== Frequently Asked Questions ==
45
+
46
+= The waiting icon keeps spinning forever. =
47
+
48
+[Check for JavaScript errors](http://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors). If it's an AJAX request, check its output.
49
+
50
+== Screenshots ==
51
+
52
+1. Basic connection metabox
53
+2. Advanced connection metabox
54
+3. Admin column
55
+4. Widget
56
+5. Connection Types screen
57
+
58
+== Changelog ==
59
+
60
+= 1.6.5 =
61
+* fixed error when Mustache is already loaded. props ApatheticG
62
+* fixed WP_User_Query warning. props PatelUtkarsh
63
+* added Chinese translation. props iwillhappy1314
64
+
65
+= 1.6.4 =
66
+* added Danish translation. props phh
67
+* updated Swedish translation. props EyesX
68
+* fixed issue with multiple `parse_query` calls. props hezachenary
69
+* added `p2p_post_admin_column_link` and `p2p_user_admin_column_link` filters. props PareshRadadiya
70
+
71
+= 1.6.3 =
72
+* added Serbian translation. props Borisa Djuraskovic
73
+* fixed spinner in admin box. props yamablam
74
+* fixed JavaScript error related to Backbone. props ericandrewlewis
75
+* made 'p2p_connected_title' filter work for users too. props MZAWeb
76
+* added support for 'dropdown_title' labels. props GaryJones
77
+* made `get_related()` consider all connected items
78
+
79
+= 1.6.2 =
80
+* fixed URL query handling. props ntns
81
+* store `WP_Error` instance instead of calling `trigger_error()`. props MZAWeb
82
+* fixed warning when used with Multilingual Press. props dimadin
83
+* introduced `p2p_connected_title` filter. props petitphp
84
+
85
+= 1.6.1 =
86
+* fixed user column handling. props versusbassz
87
+* fixed PHP strict standards warnings. props meloniq
88
+* added Estonian translation. props RistoNiinemets
89
+* added Finnish translation. props danielck
90
+
91
+= 1.6 =
92
+* introduced `p2p_candidate_title` filter
93
+* introduced JavaScript API
94
+* added Japanese translation
95
+* various refactorings
96
+
97
+= 1.5.2 =
98
+* fixed get_prev() and get_next()
99
+* introduced get_adjacent_items()
100
+* fixed admin column titles
101
+* made admin column titles show up before the post date. props luk3thomas
102
+* added 'help' key to 'from_labels' and 'to_labels' arrays. props tareq1988
103
+
104
+= 1.5.1 =
105
+* fix fatal error on activation. props benmay
106
+
107
+= 1.5 =
108
+* added [admin dropdowns](https://github.com/scribu/wp-posts-to-posts/wiki/Admin-dropdown-display)
109
+* fixed SQL error related to user connections
110
+* fixed 'labels' handling and added 'column_title' subkey
111
+* refactor metabox JavaScript using Backbone.js
112
+* lazy-load connection candidates, for faster page loads
113
+* lazy-load PHP classes using `spl_register_autoload()`
114
+
115
+= 1.4.3 =
116
+* various bug fixes
117
+* added 'inline' mode for shortcodes
118
+* replaced 'trash' icon with 'minus' icon
119
+* pass direction to 'default_cb'
120
+
121
+= 1.4.2 =
122
+* fixed each_connected() returning wrapped objects
123
+* fixed issue with user queries and get_current_screen()
124
+* fixed "Delete all connections" button
125
+* fixed bugs with reciprocal and non-reciprocal indeterminate connection types
126
+* added Dutch translation
127
+
128
+= 1.4.1 =
129
+* fixed errors in admin box
130
+* fixed each_connected()
131
+
132
+= 1.4 =
133
+* added 'p2p_init' hook
134
+* replaced 'View All' button with '+ Create connections' toggle
135
+* improved usability of connection candidate UI
136
+* fixed issues related to auto-drafts
137
+* show columns on the admin user list screen
138
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-1-4.html)
139
+
140
+= 1.3.1 =
141
+* sanitize connection fields values on save, preventing security exploits
142
+* improved connection field default value handling
143
+* added 'default_cb' as an optional key when defining connection fields
144
+* fixed parameter order for 'p2p_admin_box_show' filter
145
+* pass the current post ID to the 'p2p_new_post_args' filter
146
+
147
+= 1.3 =
148
+* allow passing entire objects to get_connected(), connect() etc.
149
+* made get_related() work with posts-to-users connections
150
+* made each_connected() work with simple array of posts
151
+* introduced [p2p_connected] and [p2p_related] shortcodes
152
+* allow 'default' parameter in 'fields' array
153
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-1-3.html)
154
+
155
+= 1.2 =
156
+* added Tools -> Connection Types admin screen
157
+* fixed migration script
158
+* made p2p_get_connections() accept arrays of ids
159
+* added 'separator' parameter to p2p_list_posts()
160
+* made P2P_Directed_Type->connect() return WP_Error instances instead of just false
161
+* when a user is deleted, delete all the associated connections
162
+* fixed conflict with bbPress Topics for Posts plugin
163
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-1-2.html)
164
+
165
+= 1.1.6 =
166
+* convert "View All" tab into button
167
+* refresh candidate list after deleting a connection
168
+* fix cardinality check
169
+* introduce 'p2p_connection_type_args' filter
170
+* make 'connected_type' accept an array of connection type names
171
+* inadvertently remove support for queries without 'connected_type' parameter
172
+
173
+= 1.1.5 =
174
+* added P2P_Connection_Type->replace() method
175
+* added 'self_connections' flag to p2p_register_connection_type()
176
+* made P2P_Connection_Type->each_connected() work for posts-to-users connections
177
+* made admin list table columns work for posts-to-users connections
178
+* fixed 'from_labels' and 'to_labels' parameters
179
+* fixed search being limited only to post titles
180
+
181
+= 1.1.4 =
182
+* show attachment thumbnail instead of title
183
+* merged 'from_object' into 'from' and 'to_object' into 'to'
184
+* made posts-to-users queries respect 'to_query_vars' args
185
+* added $prop_name parameter to P2P_Type::each_connected()
186
+* fixed connection field name conflict
187
+
188
+= 1.1.3 =
189
+* fixed regression related to posts-to-users direction
190
+* fixed admin columns overwriting each other
191
+* fixed incorrect direction in admin column links
192
+* added notices when connection type is not properly defined
193
+
194
+= 1.1.2 =
195
+* fixed fields not being saved for posts-to-users connections
196
+* fixed missing "New Post" tab in admin box
197
+* fixed notice when deleting post
198
+
199
+= 1.1.1 =
200
+* fixed faulty scbFramework loading
201
+* simplified syntax for defining posts-to-users connection types
202
+
203
+= 1.1 =
204
+* add p2p_type column to the wp_p2p table
205
+* new low-level api: p2p_create_connection(), p2p_get_connections(), p2p_delete_connections(), p2p_connection_exists()
206
+* support posts-to-users and users-to-posts connection types in the admin
207
+* add 'from_labels' and 'to_labels' args to p2p_register_connection_type()
208
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-1-1.html)
209
+
210
+= 1.0.1 =
211
+* don't show metabox at all if user doesn't have the required capability
212
+* fix checkbox handling when there are no other input fields
213
+* improve metabox styling
214
+* rename 'show_ui' to 'admin_box'
215
+* add 'admin_column' parameter
216
+
217
+= 1.0 =
218
+* widget can now list related posts
219
+* add P2P_Connection_Type::get_related() method
220
+* add 'can_create_post' arg to p2p_register_connection_type()
221
+* two-box mode for `'reciprocal' => false`
222
+* more options for 'show_ui'
223
+* allow checkboxes, radio buttons and textareas as connection fields
224
+* allow drag & drop ordering in both directions
225
+* added get_previous(), get_next() and get_adjacent() methods to P2P_Connection_Type
226
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-1-0.html)
227
+
228
+= 0.9.5 =
229
+* add '{from|to}_query_vars' args to p2p_register_connection_type()
230
+* add 'cardinality' arg to p2p_register_connection_type()
231
+* add 'id' arg and p2p_type() function
232
+* introduce p2p_split_posts()
233
+* remove p2p_connect(), p2p_disconnect() and p2p_get_connected()
234
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-0-9-5.html)
235
+
236
+= 0.9.2 =
237
+* fix incorrect storage when creating a connection from the other end
238
+* respect 'reciprocal' => false when 'from' == 'to'
239
+* pass pagination numbers through number_format_i18n()
240
+
241
+= 0.9.1 =
242
+* fix bug with each_connected()
243
+* add widget
244
+* allow 'from' and 'to' to be arrays again
245
+* improve RTL support
246
+
247
+= 0.9 =
248
+* introduce dropdown connection fields
249
+* introduce 'sortable' arg to p2p_register_connection_type()
250
+* introduce 'data' arg to p2p_register_connection_type()
251
+* replace 'box' arg with hooks
252
+* replace p2p_each_connected() with P2P_Post_Type->each_connected()
253
+* allow using 'connected_meta' and 'connected_orderby' together
254
+* fix some translations
255
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-0-9.html)
256
+
257
+= 0.8 =
258
+* added ability to create draft posts from the connection box. props Oren Kolker
259
+* show post status in the connection box. props [Michael Fields](http://wordpress.mfields.org/)
260
+* reduced number of queries by caching connection information
261
+* revamped p2p_each_connected()
262
+* introduced p2p_list_posts()
263
+* introduced 'connected_orderby', 'connected_order' and 'connected_order_num' query vars
264
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-0-8.html)
265
+
266
+= 0.7 =
267
+* improved UI. props [Alex Ciobica](http://ciobi.ca/)
268
+* added 'fields', 'context' and 'prevent_duplicates' args to p2p_register_connection_type()
269
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-0-7.html)
270
+
271
+= 0.6 =
272
+* added p2p_each_connected()
273
+* fixed p2p_is_connected()
274
+* made p2p_get_connected() return p2p_ids even with `$direction = 'any'`
275
+* made compatible with [Proper Network Activation](http://wordpress.org/extend/plugins/proper-network-activation)
276
+* [more info](http://scribu.net/wordpress/posts-to-posts/version-0-6.html)
277
+
278
+= 0.5.1 =
279
+* fixed fatal error on Menus screen
280
+
281
+= 0.5 =
282
+* added 'connected_meta' var to WP_Query
283
+* attach p2p_id to each post found via WP_Query
284
+* 'connected_to' => 'any' etc.
285
+* $data parameter can also be a meta_query
286
+* metabox bugfixes
287
+* fixed l10n loading
288
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-0-5.html)
289
+
290
+= 0.4 =
291
+* introduced 'connected_from', 'connected_to', 'connected' vars to WP_Query
292
+* replaced $reciprocal with $data as the third argument
293
+* p2p_register_connection_type() accepts an associative array as arguments
294
+* removed p2p_list_connected()
295
+* added p2p_delete_connection()
296
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-0-4.html)
297
+
298
+= 0.3 =
299
+* store connections using a taxonomy instead of postmeta
300
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-0-3.html)
301
+
302
+= 0.2 =
303
+* UI that supports multiple related posts. props [Patrik Bón](http://www.mrhead.sk/)
304
+* added p2p_list_connected() template tag
305
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-0-2.html)
306
+
307
+= 0.1 =
308
+* initial release
309
+* [more info](http://scribu.net/wordpress/posts-to-posts/p2p-0-1.html)

+ 26
- 0
plugins/posts-to-posts/vendor/mustache/mustache/.php_cs Переглянути файл

@@ -0,0 +1,26 @@
1
+<?php
2
+
3
+use Symfony\CS\Config\Config;
4
+use Symfony\CS\FixerInterface;
5
+
6
+$config = Config::create()
7
+    // use symfony level and extra fixers:
8
+    ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
9
+    ->fixers(array(
10
+        '-concat_without_spaces',
11
+        '-pre_increment',
12
+        '-unalign_double_arrow',
13
+        '-unalign_equals',
14
+        'align_double_arrow',
15
+        'concat_with_spaces',
16
+        'ordered_use',
17
+        'strict',
18
+    ))
19
+    ->setUsingLinter(false);
20
+
21
+$finder = $config->getFinder()
22
+    ->in('bin')
23
+    ->in('src')
24
+    ->in('test');
25
+
26
+return $config;

+ 13
- 0
plugins/posts-to-posts/vendor/mustache/mustache/.styleci.yml Переглянути файл

@@ -0,0 +1,13 @@
1
+preset: symfony
2
+
3
+enabled:
4
+  - align_double_arrow
5
+  - concat_with_spaces
6
+  - ordered_use
7
+  - strict
8
+
9
+disabled:
10
+  - concat_without_spaces
11
+  - pre_increment
12
+  - unalign_double_arrow
13
+  - unalign_equals

+ 19
- 0
plugins/posts-to-posts/vendor/mustache/mustache/.travis.yml Переглянути файл

@@ -0,0 +1,19 @@
1
+language: php
2
+
3
+install:
4
+  - curl http://get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer.phar
5
+
6
+script:
7
+  - phpunit
8
+  - if [[ `php -r "echo version_compare(PHP_VERSION, '5.3.6', '>=') && !defined('HHVM_VERSION');"` ]]; then php php-cs-fixer.phar --diff --dry-run -vv fix; fi
9
+
10
+php:
11
+  - 5.2
12
+  - 5.3
13
+  - 5.4
14
+  - 5.5
15
+  - 5.6
16
+  - 7.0
17
+  - hhvm
18
+
19
+sudo: false

+ 35
- 0
plugins/posts-to-posts/vendor/mustache/mustache/CONTRIBUTING.md Переглянути файл

@@ -0,0 +1,35 @@
1
+# Contributions welcome!
2
+
3
+
4
+### Here's a quick guide:
5
+
6
+ 1. [Fork the repo on GitHub](https://github.com/bobthecow/mustache.php).
7
+
8
+ 2. Update submodules: `git submodule update --init`
9
+
10
+ 3. Run the test suite. We only take pull requests with passing tests, and it's great to know that you have a clean slate. Make sure you have PHPUnit 3.5+, then run `phpunit` from the project directory.
11
+
12
+ 4. Add tests for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, add a test!
13
+
14
+ 5. Make the tests pass.
15
+
16
+ 6. Push your fork to GitHub and submit a pull request against the `dev` branch.
17
+
18
+
19
+### You can do some things to increase the chance that your pull request is accepted the first time:
20
+
21
+ * Submit one pull request per fix or feature.
22
+ * To help with that, do all your work in a feature branch (e.g. `feature/my-alsome-feature`).
23
+ * Follow the conventions you see used in the project.
24
+ * Use `phpcs --standard=PSR2` to check your changes against the coding standard.
25
+ * Write tests that fail without your code, and pass with it.
26
+ * Don't bump version numbers. Those will be updated — per [semver](http://semver.org) — once your change is merged into `master`.
27
+ * Update any documentation: docblocks, README, examples, etc.
28
+ * ... Don't update the wiki until your change is merged and released, but make a note in your pull request so we don't forget.
29
+
30
+
31
+### Mustache.php follows the PSR-* coding standards:
32
+
33
+ * [PSR-0: Class and file naming conventions](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)
34
+ * [PSR-1: Basic coding standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)
35
+ * [PSR-2: Coding style guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)

+ 21
- 0
plugins/posts-to-posts/vendor/mustache/mustache/LICENSE Переглянути файл

@@ -0,0 +1,21 @@
1
+The MIT License (MIT)
2
+
3
+Copyright (c) 2010-2015 Justin Hileman
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
21
+OR OTHER DEALINGS IN THE SOFTWARE.

+ 71
- 0
plugins/posts-to-posts/vendor/mustache/mustache/README.md Переглянути файл

@@ -0,0 +1,71 @@
1
+Mustache.php
2
+============
3
+
4
+A [Mustache](http://mustache.github.com/) implementation in PHP.
5
+
6
+[![Package version](http://img.shields.io/packagist/v/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
7
+[![Build status](http://img.shields.io/travis/bobthecow/mustache.php/dev.svg?style=flat-square)](http://travis-ci.org/bobthecow/mustache.php)
8
+[![Monthly downloads](http://img.shields.io/packagist/dm/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
9
+
10
+
11
+Usage
12
+-----
13
+
14
+A quick example:
15
+
16
+```php
17
+<?php
18
+$m = new Mustache_Engine;
19
+echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!"
20
+```
21
+
22
+
23
+And a more in-depth example -- this is the canonical Mustache template:
24
+
25
+```html+jinja
26
+Hello {{name}}
27
+You have just won {{value}} dollars!
28
+{{#in_ca}}
29
+Well, {{taxed_value}} dollars, after taxes.
30
+{{/in_ca}}
31
+```
32
+
33
+
34
+Create a view "context" object -- which could also be an associative array, but those don't do functions quite as well:
35
+
36
+```php
37
+<?php
38
+class Chris {
39
+    public $name  = "Chris";
40
+    public $value = 10000;
41
+
42
+    public function taxed_value() {
43
+        return $this->value - ($this->value * 0.4);
44
+    }
45
+
46
+    public $in_ca = true;
47
+}
48
+```
49
+
50
+
51
+And render it:
52
+
53
+```php
54
+<?php
55
+$m = new Mustache_Engine;
56
+$chris = new Chris;
57
+echo $m->render($template, $chris);
58
+```
59
+
60
+
61
+And That's Not All!
62
+-------------------
63
+
64
+Read [the Mustache.php documentation](https://github.com/bobthecow/mustache.php/wiki/Home) for more information.
65
+
66
+
67
+See Also
68
+--------
69
+
70
+ * [Readme for the Ruby Mustache implementation](http://github.com/defunkt/mustache/blob/master/README.md).
71
+ * [mustache(5)](http://mustache.github.com/mustache.5.html) man page.

+ 25
- 0
plugins/posts-to-posts/vendor/mustache/mustache/composer.json Переглянути файл

@@ -0,0 +1,25 @@
1
+{
2
+    "name": "mustache/mustache",
3
+    "description": "A Mustache implementation in PHP.",
4
+    "keywords": ["templating", "mustache"],
5
+    "homepage": "https://github.com/bobthecow/mustache.php",
6
+    "type": "library",
7
+    "license": "MIT",
8
+    "authors": [
9
+        {
10
+            "name": "Justin Hileman",
11
+            "email": "justin@justinhileman.info",
12
+            "homepage": "http://justinhileman.com"
13
+        }
14
+    ],
15
+    "require": {
16
+        "php": ">=5.2.4"
17
+    },
18
+    "require-dev": {
19
+        "phpunit/phpunit": "~3.7|~4.0",
20
+        "fabpot/php-cs-fixer": "~1.6"
21
+    },
22
+    "autoload": {
23
+        "psr-0": { "Mustache": "src/" }
24
+    }
25
+}

+ 17
- 0
plugins/posts-to-posts/vendor/mustache/mustache/phpunit.xml.dist Переглянути файл

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<phpunit backupGlobals="false" colors="true" bootstrap="./test/bootstrap.php">
3
+	<testsuite name="Mustache">
4
+		<directory suffix="Test.php">./test</directory>
5
+		<exclude>./test/Mustache/Test/FiveThree</exclude>
6
+	</testsuite>
7
+
8
+	<testsuite name="Mustache FiveThree">
9
+		<directory suffix="Test.php" phpVersion="5.3.0" phpVersionOperator=">=">./test/Mustache/Test/FiveThree</directory>
10
+	</testsuite>
11
+
12
+	<filter>
13
+		<whitelist>
14
+			<directory suffix=".php">./src/Mustache</directory>
15
+		</whitelist>
16
+	</filter>
17
+</phpunit>

+ 74
- 0
plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Autoloader.php Переглянути файл

@@ -0,0 +1,74 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2015 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+/**
13
+ * Mustache class autoloader.
14
+ */
15
+class Mustache_Autoloader
16
+{
17
+    private $baseDir;
18
+
19
+    /**
20
+     * Autoloader constructor.
21
+     *
22
+     * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..')
23
+     */
24
+    public function __construct($baseDir = null)
25
+    {
26
+        if ($baseDir === null) {
27
+            $baseDir = dirname(__FILE__) . '/..';
28
+        }
29
+
30
+        // realpath doesn't always work, for example, with stream URIs
31
+        $realDir = realpath($baseDir);
32
+        if (is_dir($realDir)) {
33
+            $this->baseDir = $realDir;
34
+        } else {
35
+            $this->baseDir = $baseDir;
36
+        }
37
+    }
38
+
39
+    /**
40
+     * Register a new instance as an SPL autoloader.
41
+     *
42
+     * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..')
43
+     *
44
+     * @return Mustache_Autoloader Registered Autoloader instance
45
+     */
46
+    public static function register($baseDir = null)
47
+    {
48
+        $loader = new self($baseDir);
49
+        spl_autoload_register(array($loader, 'autoload'));
50
+
51
+        return $loader;
52
+    }
53
+
54
+    /**
55
+     * Autoload Mustache classes.
56
+     *
57
+     * @param string $class
58
+     */
59
+    public function autoload($class)
60
+    {
61
+        if ($class[0] === '\\') {
62
+            $class = substr($class, 1);
63
+        }
64
+
65
+        if (strpos($class, 'Mustache') !== 0) {
66
+            return;
67
+        }
68
+
69
+        $file = sprintf('%s/%s.php', $this->baseDir, str_replace('_', '/', $class));
70
+        if (is_file($file)) {
71
+            require $file;
72
+        }
73
+    }
74
+}

+ 36
- 0
plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Cache.php Переглянути файл

@@ -0,0 +1,36 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2015 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+/**
13
+ * Mustache Cache interface.
14
+ *
15
+ * Interface for caching and loading Mustache_Template classes
16
+ * generated by the Mustache_Compiler.
17
+ */
18
+interface Mustache_Cache
19
+{
20
+    /**
21
+     * Load a compiled Mustache_Template class from cache.
22
+     *
23
+     * @param string $key
24
+     *
25
+     * @return bool indicates successfully class load
26
+     */
27
+    public function load($key);
28
+
29
+    /**
30
+     * Cache and load a compiled Mustache_Template class.
31
+     *
32
+     * @param string $key
33
+     * @param string $value
34
+     */
35
+    public function cache($key, $value);
36
+}

+ 60
- 0
plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Cache/AbstractCache.php Переглянути файл

@@ -0,0 +1,60 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2015 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+/**
13
+ * Abstract Mustache Cache class.
14
+ *
15
+ * Provides logging support to child implementations.
16
+ *
17
+ * @abstract
18
+ */
19
+abstract class Mustache_Cache_AbstractCache implements Mustache_Cache
20
+{
21
+    private $logger = null;
22
+
23
+    /**
24
+     * Get the current logger instance.
25
+     *
26
+     * @return Mustache_Logger|Psr\Log\LoggerInterface
27
+     */
28
+    public function getLogger()
29
+    {
30
+        return $this->logger;
31
+    }
32
+
33
+    /**
34
+     * Set a logger instance.
35
+     *
36
+     * @param Mustache_Logger|Psr\Log\LoggerInterface $logger
37
+     */
38
+    public function setLogger($logger = null)
39
+    {
40
+        if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) {
41
+            throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.');
42
+        }
43
+
44
+        $this->logger = $logger;
45
+    }
46
+
47
+    /**
48
+     * Add a log record if logging is enabled.
49
+     *
50
+     * @param int    $level   The logging level
51
+     * @param string $message The log message
52
+     * @param array  $context The log context
53
+     */
54
+    protected function log($level, $message, array $context = array())
55
+    {
56
+        if (isset($this->logger)) {
57
+            $this->logger->log($level, $message, $context);
58
+        }
59
+    }
60
+}

+ 155
- 0
plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Cache/FilesystemCache.php Переглянути файл

@@ -0,0 +1,155 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2015 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+/**
13
+ * Mustache Cache filesystem implementation.
14
+ *
15
+ * A FilesystemCache instance caches Mustache Template classes from the filesystem by name:
16
+ *
17
+ *     $cache = new Mustache_Cache_FilesystemCache(dirname(__FILE__).'/cache');
18
+ *     $cache->cache($className, $compiledSource);
19
+ *
20
+ * The FilesystemCache benefits from any opcode caching that may be setup in your environment. So do that, k?
21
+ */
22
+class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
23
+{
24
+    private $baseDir;
25
+    private $fileMode;
26
+
27
+    /**
28
+     * Filesystem cache constructor.
29
+     *
30
+     * @param string $baseDir  Directory for compiled templates.
31
+     * @param int    $fileMode Override default permissions for cache files. Defaults to using the system-defined umask.
32
+     */
33
+    public function __construct($baseDir, $fileMode = null)
34
+    {
35
+        $this->baseDir = $baseDir;
36
+        $this->fileMode = $fileMode;
37
+    }
38
+
39
+    /**
40
+     * Load the class from cache using `require_once`.
41
+     *
42
+     * @param string $key
43
+     *
44
+     * @return bool
45
+     */
46
+    public function load($key)
47
+    {
48
+        $fileName = $this->getCacheFilename($key);
49
+        if (!is_file($fileName)) {
50
+            return false;
51
+        }
52
+
53
+        require_once $fileName;
54
+
55
+        return true;
56
+    }
57
+
58
+    /**
59
+     * Cache and load the compiled class.
60
+     *
61
+     * @param string $key
62
+     * @param string $value
63
+     */
64
+    public function cache($key, $value)
65
+    {
66
+        $fileName = $this->getCacheFilename($key);
67
+
68
+        $this->log(
69
+            Mustache_Logger::DEBUG,
70
+            'Writing to template cache: "{fileName}"',
71
+            array('fileName' => $fileName)
72
+        );
73
+
74
+        $this->writeFile($fileName, $value);
75
+        $this->load($key);
76
+    }
77
+
78
+    /**
79
+     * Build the cache filename.
80
+     * Subclasses should override for custom cache directory structures.
81
+     *
82
+     * @param string $name
83
+     *
84
+     * @return string
85
+     */
86
+    protected function getCacheFilename($name)
87
+    {
88
+        return sprintf('%s/%s.php', $this->baseDir, $name);
89
+    }
90
+
91
+    /**
92
+     * Create cache directory.
93
+     *
94
+     * @throws Mustache_Exception_RuntimeException If unable to create directory
95
+     *
96
+     * @param string $fileName
97
+     *
98
+     * @return string
99
+     */
100
+    private function buildDirectoryForFilename($fileName)
101
+    {
102
+        $dirName = dirname($fileName);
103
+        if (!is_dir($dirName)) {
104
+            $this->log(
105
+                Mustache_Logger::INFO,
106
+                'Creating Mustache template cache directory: "{dirName}"',
107
+                array('dirName' => $dirName)
108
+            );
109
+
110
+            @mkdir($dirName, 0777, true);
111
+            if (!is_dir($dirName)) {
112
+                throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName));
113
+            }
114
+        }
115
+
116
+        return $dirName;
117
+    }
118
+
119
+    /**
120
+     * Write cache file.
121
+     *
122
+     * @throws Mustache_Exception_RuntimeException If unable to write file
123
+     *
124
+     * @param string $fileName
125
+     * @param string $value
126
+     */
127
+    private function writeFile($fileName, $value)
128
+    {
129
+        $dirName = $this->buildDirectoryForFilename($fileName);
130
+
131
+        $this->log(
132
+            Mustache_Logger::DEBUG,
133
+            'Caching compiled template to "{fileName}"',
134
+            array('fileName' => $fileName)
135
+        );
136
+
137
+        $tempFile = tempnam($dirName, basename($fileName));
138
+        if (false !== @file_put_contents($tempFile, $value)) {
139
+            if (@rename($tempFile, $fileName)) {
140
+                $mode = isset($this->fileMode) ? $this->fileMode : (0666 & ~umask());
141
+                @chmod($fileName, $mode);
142
+
143
+                return;
144
+            }
145
+
146
+            $this->log(
147
+                Mustache_Logger::ERROR,
148
+                'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
149
+                array('tempName' => $tempFile, 'fileName' => $fileName)
150
+            );
151
+        }
152
+
153
+        throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
154
+    }
155
+}

+ 47
- 0
plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Cache/NoopCache.php Переглянути файл

@@ -0,0 +1,47 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2015 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+/**
13
+ * Mustache Cache in-memory implementation.
14
+ *
15
+ * The in-memory cache is used for uncached lambda section templates. It's also useful during development, but is not
16
+ * recommended for production use.
17
+ */
18
+class Mustache_Cache_NoopCache extends Mustache_Cache_AbstractCache
19
+{
20
+    /**
21
+     * Loads nothing. Move along.
22
+     *
23
+     * @param string $key
24
+     *
25
+     * @return bool
26
+     */
27
+    public function load($key)
28
+    {
29
+        return false;
30
+    }
31
+
32
+    /**
33
+     * Loads the compiled Mustache Template class without caching.
34
+     *
35
+     * @param string $key
36
+     * @param string $value
37
+     */
38
+    public function cache($key, $value)
39
+    {
40
+        $this->log(
41
+            Mustache_Logger::WARNING,
42
+            'Template cache disabled, evaluating "{className}" class at runtime',
43
+            array('className' => $key)
44
+        );
45
+        eval('?>' . $value);
46
+    }
47
+}

+ 681
- 0
plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Compiler.php Переглянути файл

@@ -0,0 +1,681 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2015 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+/**
13
+ * Mustache Compiler class.
14
+ *
15
+ * This class is responsible for turning a Mustache token parse tree into normal PHP source code.
16
+ */
17
+class Mustache_Compiler
18
+{
19
+    private $pragmas;
20
+    private $defaultPragmas = array();
21
+    private $sections;
22
+    private $blocks;
23
+    private $source;
24
+    private $indentNextLine;
25
+    private $customEscape;
26
+    private $entityFlags;
27
+    private $charset;
28
+    private $strictCallables;
29
+
30
+    /**
31
+     * Compile a Mustache token parse tree into PHP source code.
32
+     *
33
+     * @param string $source          Mustache Template source code
34
+     * @param string $tree            Parse tree of Mustache tokens
35
+     * @param string $name            Mustache Template class name
36
+     * @param bool   $customEscape    (default: false)
37
+     * @param string $charset         (default: 'UTF-8')
38
+     * @param bool   $strictCallables (default: false)
39
+     * @param int    $entityFlags     (default: ENT_COMPAT)
40
+     *
41
+     * @return string Generated PHP source code
42
+     */
43
+    public function compile($source, array $tree, $name, $customEscape = false, $charset = 'UTF-8', $strictCallables = false, $entityFlags = ENT_COMPAT)
44
+    {
45
+        $this->pragmas         = $this->defaultPragmas;
46
+        $this->sections        = array();
47
+        $this->blocks          = array();
48
+        $this->source          = $source;
49
+        $this->indentNextLine  = true;
50
+        $this->customEscape    = $customEscape;
51
+        $this->entityFlags     = $entityFlags;
52
+        $this->charset         = $charset;
53
+        $this->strictCallables = $strictCallables;
54
+
55
+        return $this->writeCode($tree, $name);
56
+    }
57
+
58
+    /**
59
+     * Enable pragmas across all templates, regardless of the presence of pragma
60
+     * tags in the individual templates.
61
+     *
62
+     * @internal Users should set global pragmas in Mustache_Engine, not here :)
63
+     *
64
+     * @param string[] $pragmas
65
+     */
66
+    public function setPragmas(array $pragmas)
67
+    {
68
+        $this->pragmas = array();
69
+        foreach ($pragmas as $pragma) {
70
+            $this->pragmas[$pragma] = true;
71
+        }
72
+        $this->defaultPragmas = $this->pragmas;
73
+    }
74
+
75
+    /**
76
+     * Helper function for walking the Mustache token parse tree.
77
+     *
78
+     * @throws Mustache_Exception_SyntaxException upon encountering unknown token types.
79
+     *
80
+     * @param array $tree  Parse tree of Mustache tokens
81
+     * @param int   $level (default: 0)
82
+     *
83
+     * @return string Generated PHP source code
84
+     */
85
+    private function walk(array $tree, $level = 0)
86
+    {
87
+        $code = '';
88
+        $level++;
89
+        foreach ($tree as $node) {
90
+            switch ($node[Mustache_Tokenizer::TYPE]) {
91
+                case Mustache_Tokenizer::T_PRAGMA:
92
+                    $this->pragmas[$node[Mustache_Tokenizer::NAME]] = true;
93
+                    break;
94
+
95
+                case Mustache_Tokenizer::T_SECTION:
96
+                    $code .= $this->section(
97
+                        $node[Mustache_Tokenizer::NODES],
98
+                        $node[Mustache_Tokenizer::NAME],
99
+                        isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(),
100
+                        $node[Mustache_Tokenizer::INDEX],
101
+                        $node[Mustache_Tokenizer::END],
102
+                        $node[Mustache_Tokenizer::OTAG],
103
+                        $node[Mustache_Tokenizer::CTAG],
104
+                        $level
105
+                    );
106
+                    break;
107
+
108
+                case Mustache_Tokenizer::T_INVERTED:
109
+                    $code .= $this->invertedSection(
110
+                        $node[Mustache_Tokenizer::NODES],
111
+                        $node[Mustache_Tokenizer::NAME],
112
+                        isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(),
113
+                        $level
114
+                    );
115
+                    break;
116
+
117
+                case Mustache_Tokenizer::T_PARTIAL:
118
+                    $code .= $this->partial(
119
+                        $node[Mustache_Tokenizer::NAME],
120
+                        isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '',
121
+                        $level
122
+                    );
123
+                    break;
124
+
125
+                case Mustache_Tokenizer::T_PARENT:
126
+                    $code .= $this->parent(
127
+                        $node[Mustache_Tokenizer::NAME],
128
+                        isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '',
129
+                        $node[Mustache_Tokenizer::NODES],
130
+                        $level
131
+                    );
132
+                    break;
133
+
134
+                case Mustache_Tokenizer::T_BLOCK_ARG:
135
+                    $code .= $this->blockArg(
136
+                        $node[Mustache_Tokenizer::NODES],
137
+                        $node[Mustache_Tokenizer::NAME],
138
+                        $node[Mustache_Tokenizer::INDEX],
139
+                        $node[Mustache_Tokenizer::END],
140
+                        $node[Mustache_Tokenizer::OTAG],
141
+                        $node[Mustache_Tokenizer::CTAG],
142
+                        $level
143
+                    );
144
+                    break;
145
+
146
+                case Mustache_Tokenizer::T_BLOCK_VAR:
147
+                    $code .= $this->blockVar(
148
+                        $node[Mustache_Tokenizer::NODES],
149
+                        $node[Mustache_Tokenizer::NAME],
150
+                        $node[Mustache_Tokenizer::INDEX],
151
+                        $node[Mustache_Tokenizer::END],
152
+                        $node[Mustache_Tokenizer::OTAG],
153
+                        $node[Mustache_Tokenizer::CTAG],
154
+                        $level
155
+                    );
156
+                    break;
157
+
158
+                case Mustache_Tokenizer::T_COMMENT:
159
+                    break;
160
+
161
+                case Mustache_Tokenizer::T_ESCAPED:
162
+                case Mustache_Tokenizer::T_UNESCAPED:
163
+                case Mustache_Tokenizer::T_UNESCAPED_2:
164
+                    $code .= $this->variable(
165
+                        $node[Mustache_Tokenizer::NAME],
166
+                        isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(),
167
+                        $node[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_ESCAPED,
168
+                        $level
169
+                    );
170
+                    break;
171
+
172
+                case Mustache_Tokenizer::T_TEXT:
173
+                    $code .= $this->text($node[Mustache_Tokenizer::VALUE], $level);
174
+                    break;
175
+
176
+                default:
177
+                    throw new Mustache_Exception_SyntaxException(sprintf('Unknown token type: %s', $node[Mustache_Tokenizer::TYPE]), $node);
178
+            }
179
+        }
180
+
181
+        return $code;
182
+    }
183
+
184
+    const KLASS = '<?php
185
+
186
+        class %s extends Mustache_Template
187
+        {
188
+            private $lambdaHelper;%s
189
+
190
+            public function renderInternal(Mustache_Context $context, $indent = \'\')
191
+            {
192
+                $this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
193
+                $buffer = \'\';
194
+                $newContext = array();
195
+        %s
196
+
197
+                return $buffer;
198
+            }
199
+        %s
200
+        %s
201
+        }';
202
+
203
+    const KLASS_NO_LAMBDAS = '<?php
204
+
205
+        class %s extends Mustache_Template
206
+        {%s
207
+            public function renderInternal(Mustache_Context $context, $indent = \'\')
208
+            {
209
+                $buffer = \'\';
210
+                $newContext = array();
211
+        %s
212
+
213
+                return $buffer;
214
+            }
215
+        }';
216
+
217
+    const STRICT_CALLABLE = 'protected $strictCallables = true;';
218
+
219
+    /**
220
+     * Generate Mustache Template class PHP source.
221
+     *
222
+     * @param array  $tree Parse tree of Mustache tokens
223
+     * @param string $name Mustache Template class name
224
+     *
225
+     * @return string Generated PHP source code
226
+     */
227
+    private function writeCode($tree, $name)
228
+    {
229
+        $code     = $this->walk($tree);
230
+        $sections = implode("\n", $this->sections);
231
+        $blocks   = implode("\n", $this->blocks);
232
+        $klass    = empty($this->sections) && empty($this->blocks) ? self::KLASS_NO_LAMBDAS : self::KLASS;
233
+
234
+        $callable = $this->strictCallables ? $this->prepare(self::STRICT_CALLABLE) : '';
235
+
236
+        return sprintf($this->prepare($klass, 0, false, true), $name, $callable, $code, $sections, $blocks);
237
+    }
238
+
239
+    const BLOCK_VAR = '
240
+        $blockFunction = $context->findInBlock(%s);
241
+        if (is_callable($blockFunction)) {
242
+            $buffer .= call_user_func($blockFunction, $context);
243
+        } else {%s
244
+        }
245
+    ';
246
+
247
+    /**
248
+     * Generate Mustache Template inheritance block variable PHP source.
249
+     *
250
+     * @param array  $nodes Array of child tokens
251
+     * @param string $id    Section name
252
+     * @param int    $start Section start offset
253
+     * @param int    $end   Section end offset
254
+     * @param string $otag  Current Mustache opening tag
255
+     * @param string $ctag  Current Mustache closing tag
256
+     * @param int    $level
257
+     *
258
+     * @return string Generated PHP source code
259
+     */
260
+    private function blockVar($nodes, $id, $start, $end, $otag, $ctag, $level)
261
+    {
262
+        $id = var_export($id, true);
263
+
264
+        return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $this->walk($nodes, $level));
265
+    }
266
+
267
+    const BLOCK_ARG = '$newContext[%s] = array($this, \'block%s\');';
268
+
269
+    /**
270
+     * Generate Mustache Template inheritance block argument PHP source.
271
+     *
272
+     * @param array  $nodes Array of child tokens
273
+     * @param string $id    Section name
274
+     * @param int    $start Section start offset
275
+     * @param int    $end   Section end offset
276
+     * @param string $otag  Current Mustache opening tag
277
+     * @param string $ctag  Current Mustache closing tag
278
+     * @param int    $level
279
+     *
280
+     * @return string Generated PHP source code
281
+     */
282
+    private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level)
283
+    {
284
+        $key = $this->block($nodes);
285
+        $keystr = var_export($key, true);
286
+        $id = var_export($id, true);
287
+
288
+        return sprintf($this->prepare(self::BLOCK_ARG, 1), $id, $key);
289
+    }
290
+
291
+    const BLOCK_FUNCTION = '
292
+        public function block%s($context)
293
+        {
294
+            $indent = $buffer = \'\';%s
295
+
296
+            return $buffer;
297
+        }
298
+    ';
299
+
300
+    /**
301
+     * Generate Mustache Template inheritance block function PHP source.
302
+     *
303
+     * @param array $nodes Array of child tokens
304
+     *
305
+     * @return string key of new block function
306
+     */
307
+    private function block($nodes)
308
+    {
309
+        $code = $this->walk($nodes, 0);
310
+        $key = ucfirst(md5($code));
311
+
312
+        if (!isset($this->blocks[$key])) {
313
+            $this->blocks[$key] = sprintf($this->prepare(self::BLOCK_FUNCTION, 0), $key, $code);
314
+        }
315
+
316
+        return $key;
317
+    }
318
+
319
+    const SECTION_CALL = '
320
+        // %s section
321
+        $value = $context->%s(%s);%s
322
+        $buffer .= $this->section%s($context, $indent, $value);
323
+    ';
324
+
325
+    const SECTION = '
326
+        private function section%s(Mustache_Context $context, $indent, $value)
327
+        {
328
+            $buffer = \'\';
329
+            if (%s) {
330
+                $source = %s;
331
+                $result = call_user_func($value, $source, $this->lambdaHelper);
332
+                if (strpos($result, \'{{\') === false) {
333
+                    $buffer .= $result;
334
+                } else {
335
+                    $buffer .= $this->mustache
336
+                        ->loadLambda((string) $result%s)
337
+                        ->renderInternal($context);
338
+                }
339
+            } elseif (!empty($value)) {
340
+                $values = $this->isIterable($value) ? $value : array($value);
341
+                foreach ($values as $value) {
342
+                    $context->push($value);
343
+                    %s
344
+                    $context->pop();
345
+                }
346
+            }
347
+
348
+            return $buffer;
349
+        }
350
+    ';
351
+
352
+    /**
353
+     * Generate Mustache Template section PHP source.
354
+     *
355
+     * @param array    $nodes   Array of child tokens
356
+     * @param string   $id      Section name
357
+     * @param string[] $filters Array of filters
358
+     * @param int      $start   Section start offset
359
+     * @param int      $end     Section end offset
360
+     * @param string   $otag    Current Mustache opening tag
361
+     * @param string   $ctag    Current Mustache closing tag
362
+     * @param int      $level
363
+     * @param bool     $arg     (default: false)
364
+     *
365
+     * @return string Generated section PHP source code
366
+     */
367
+    private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level, $arg = false)
368
+    {
369
+        $source   = var_export(substr($this->source, $start, $end - $start), true);
370
+        $callable = $this->getCallable();
371
+
372
+        if ($otag !== '{{' || $ctag !== '}}') {
373
+            $delims = ', ' . var_export(sprintf('{{= %s %s =}}', $otag, $ctag), true);
374
+        } else {
375
+            $delims = '';
376
+        }
377
+
378
+        $key = ucfirst(md5($delims . "\n" . $source));
379
+
380
+        if (!isset($this->sections[$key])) {
381
+            $this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $delims, $this->walk($nodes, 2));
382
+        }
383
+
384
+        if ($arg === true) {
385
+            return $key;
386
+        } else {
387
+            $method  = $this->getFindMethod($id);
388
+            $id      = var_export($id, true);
389
+            $filters = $this->getFilters($filters, $level);
390
+
391
+            return sprintf($this->prepare(self::SECTION_CALL, $level), $id, $method, $id, $filters, $key);
392
+        }
393
+    }
394
+
395
+    const INVERTED_SECTION = '
396
+        // %s inverted section
397
+        $value = $context->%s(%s);%s
398
+        if (empty($value)) {
399
+            %s
400
+        }
401
+    ';
402
+
403
+    /**
404
+     * Generate Mustache Template inverted section PHP source.
405
+     *
406
+     * @param array    $nodes   Array of child tokens
407
+     * @param string   $id      Section name
408
+     * @param string[] $filters Array of filters
409
+     * @param int      $level
410
+     *
411
+     * @return string Generated inverted section PHP source code
412
+     */
413
+    private function invertedSection($nodes, $id, $filters, $level)
414
+    {
415
+        $method  = $this->getFindMethod($id);
416
+        $id      = var_export($id, true);
417
+        $filters = $this->getFilters($filters, $level);
418
+
419
+        return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $filters, $this->walk($nodes, $level));
420
+    }
421
+
422
+    const PARTIAL_INDENT = ', $indent . %s';
423
+    const PARTIAL = '
424
+        if ($partial = $this->mustache->loadPartial(%s)) {
425
+            $buffer .= $partial->renderInternal($context%s);
426
+        }
427
+    ';
428
+
429
+    /**
430
+     * Generate Mustache Template partial call PHP source.
431
+     *
432
+     * @param string $id     Partial name
433
+     * @param string $indent Whitespace indent to apply to partial
434
+     * @param int    $level
435
+     *
436
+     * @return string Generated partial call PHP source code
437
+     */
438
+    private function partial($id, $indent, $level)
439
+    {
440
+        if ($indent !== '') {
441
+            $indentParam = sprintf(self::PARTIAL_INDENT, var_export($indent, true));
442
+        } else {
443
+            $indentParam = '';
444
+        }
445
+
446
+        return sprintf(
447
+            $this->prepare(self::PARTIAL, $level),
448
+            var_export($id, true),
449
+            $indentParam
450
+        );
451
+    }
452
+
453
+    const PARENT = '
454
+        %s
455
+
456
+        if ($parent = $this->mustache->LoadPartial(%s)) {
457
+            $context->pushBlockContext($newContext);
458
+            $buffer .= $parent->renderInternal($context, $indent);
459
+            $context->popBlockContext();
460
+        }
461
+    ';
462
+
463
+    /**
464
+     * Generate Mustache Template inheritance parent call PHP source.
465
+     *
466
+     * @param string $id       Parent tag name
467
+     * @param string $indent   Whitespace indent to apply to parent
468
+     * @param array  $children Child nodes
469
+     * @param int    $level
470
+     *
471
+     * @return string Generated PHP source code
472
+     */
473
+    private function parent($id, $indent, array $children, $level)
474
+    {
475
+        $realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs'));
476
+
477
+        return sprintf(
478
+            $this->prepare(self::PARENT, $level),
479
+            $this->walk($realChildren, $level),
480
+            var_export($id, true),
481
+            var_export($indent, true)
482
+        );
483
+    }
484
+
485
+    /**
486
+     * Helper method for filtering out non-block-arg tokens.
487
+     *
488
+     * @param array $node
489
+     *
490
+     * @return bool True if $node is a block arg token.
491
+     */
492
+    private static function onlyBlockArgs(array $node)
493
+    {
494
+        return $node[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_BLOCK_ARG;
495
+    }
496
+
497
+    const VARIABLE = '
498
+        $value = $this->resolveValue($context->%s(%s), $context, $indent);%s
499
+        $buffer .= %s%s;
500
+    ';
501
+
502
+    /**
503
+     * Generate Mustache Template variable interpolation PHP source.
504
+     *
505
+     * @param string   $id      Variable name
506
+     * @param string[] $filters Array of filters
507
+     * @param bool     $escape  Escape the variable value for output?
508
+     * @param int      $level
509
+     *
510
+     * @return string Generated variable interpolation PHP source
511
+     */
512
+    private function variable($id, $filters, $escape, $level)
513
+    {
514
+        $method  = $this->getFindMethod($id);
515
+        $id      = ($method !== 'last') ? var_export($id, true) : '';
516
+        $filters = $this->getFilters($filters, $level);
517
+        $value   = $escape ? $this->getEscape() : '$value';
518
+
519
+        return sprintf($this->prepare(self::VARIABLE, $level), $method, $id, $filters, $this->flushIndent(), $value);
520
+    }
521
+
522
+    const FILTER = '
523
+        $filter = $context->%s(%s);
524
+        if (!(%s)) {
525
+            throw new Mustache_Exception_UnknownFilterException(%s);
526
+        }
527
+        $value = call_user_func($filter, $value);%s
528
+    ';
529
+
530
+    /**
531
+     * Generate Mustache Template variable filtering PHP source.
532
+     *
533
+     * @param string[] $filters Array of filters
534
+     * @param int      $level
535
+     *
536
+     * @return string Generated filter PHP source
537
+     */
538
+    private function getFilters(array $filters, $level)
539
+    {
540
+        if (empty($filters)) {
541
+            return '';
542
+        }
543
+
544
+        $name     = array_shift($filters);
545
+        $method   = $this->getFindMethod($name);
546
+        $filter   = ($method !== 'last') ? var_export($name, true) : '';
547
+        $callable = $this->getCallable('$filter');
548
+        $msg      = var_export($name, true);
549
+
550
+        return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $callable, $msg, $this->getFilters($filters, $level));
551
+    }
552
+
553
+    const LINE = '$buffer .= "\n";';
554
+    const TEXT = '$buffer .= %s%s;';
555
+
556
+    /**
557
+     * Generate Mustache Template output Buffer call PHP source.
558
+     *
559
+     * @param string $text
560
+     * @param int    $level
561
+     *
562
+     * @return string Generated output Buffer call PHP source
563
+     */
564
+    private function text($text, $level)
565
+    {
566
+        $indentNextLine = (substr($text, -1) === "\n");
567
+        $code = sprintf($this->prepare(self::TEXT, $level), $this->flushIndent(), var_export($text, true));
568
+        $this->indentNextLine = $indentNextLine;
569
+
570
+        return $code;
571
+    }
572
+
573
+    /**
574
+     * Prepare PHP source code snippet for output.
575
+     *
576
+     * @param string $text
577
+     * @param int    $bonus          Additional indent level (default: 0)
578
+     * @param bool   $prependNewline Prepend a newline to the snippet? (default: true)
579
+     * @param bool   $appendNewline  Append a newline to the snippet? (default: false)
580
+     *
581
+     * @return string PHP source code snippet
582
+     */
583
+    private function prepare($text, $bonus = 0, $prependNewline = true, $appendNewline = false)
584
+    {
585
+        $text = ($prependNewline ? "\n" : '') . trim($text);
586
+        if ($prependNewline) {
587
+            $bonus++;
588
+        }
589
+        if ($appendNewline) {
590
+            $text .= "\n";
591
+        }
592
+
593
+        return preg_replace("/\n( {8})?/", "\n" . str_repeat(' ', $bonus * 4), $text);
594
+    }
595
+
596
+    const DEFAULT_ESCAPE = 'htmlspecialchars(%s, %s, %s)';
597
+    const CUSTOM_ESCAPE  = 'call_user_func($this->mustache->getEscape(), %s)';
598
+
599
+    /**
600
+     * Get the current escaper.
601
+     *
602
+     * @param string $value (default: '$value')
603
+     *
604
+     * @return string Either a custom callback, or an inline call to `htmlspecialchars`
605
+     */
606
+    private function getEscape($value = '$value')
607
+    {
608
+        if ($this->customEscape) {
609
+            return sprintf(self::CUSTOM_ESCAPE, $value);
610
+        }
611
+
612
+        return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true));
613
+    }
614
+
615
+    /**
616
+     * Select the appropriate Context `find` method for a given $id.
617
+     *
618
+     * The return value will be one of `find`, `findDot` or `last`.
619
+     *
620
+     * @see Mustache_Context::find
621
+     * @see Mustache_Context::findDot
622
+     * @see Mustache_Context::last
623
+     *
624
+     * @param string $id Variable name
625
+     *
626
+     * @return string `find` method name
627
+     */
628
+    private function getFindMethod($id)
629
+    {
630
+        if ($id === '.') {
631
+            return 'last';
632
+        }
633
+
634
+        if (isset($this->pragmas[Mustache_Engine::PRAGMA_ANCHORED_DOT]) && $this->pragmas[Mustache_Engine::PRAGMA_ANCHORED_DOT]) {
635
+            if (substr($id, 0, 1) === '.') {
636
+                return 'findAnchoredDot';
637
+            }
638
+        }
639
+
640
+        if (strpos($id, '.') === false) {
641
+            return 'find';
642
+        }
643
+
644
+        return 'findDot';
645
+    }
646
+
647
+    const IS_CALLABLE        = '!is_string(%s) && is_callable(%s)';
648
+    const STRICT_IS_CALLABLE = 'is_object(%s) && is_callable(%s)';
649
+
650
+    /**
651
+     * Helper function to compile strict vs lax "is callable" logic.
652
+     *
653
+     * @param string $variable (default: '$value')
654
+     *
655
+     * @return string "is callable" logic
656
+     */
657
+    private function getCallable($variable = '$value')
658
+    {
659
+        $tpl = $this->strictCallables ? self::STRICT_IS_CALLABLE : self::IS_CALLABLE;
660
+
661
+        return sprintf($tpl, $variable, $variable);
662
+    }
663
+
664
+    const LINE_INDENT = '$indent . ';
665
+
666
+    /**
667
+     * Get the current $indent prefix to write to the buffer.
668
+     *
669
+     * @return string "$indent . " or ""
670
+     */
671
+    private function flushIndent()
672
+    {
673
+        if (!$this->indentNextLine) {
674
+            return '';
675
+        }
676
+
677
+        $this->indentNextLine = false;
678
+
679
+        return self::LINE_INDENT;
680
+    }
681
+}

+ 242
- 0
plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Context.php Переглянути файл

@@ -0,0 +1,242 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2015 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+/**
13
+ * Mustache Template rendering Context.
14
+ */
15
+class Mustache_Context
16
+{
17
+    private $stack      = array();
18
+    private $blockStack = array();
19
+
20
+    /**
21
+     * Mustache rendering Context constructor.
22
+     *
23
+     * @param mixed $context Default rendering context (default: null)
24
+     */
25
+    public function __construct($context = null)
26
+    {
27
+        if ($context !== null) {
28
+            $this->stack = array($context);
29
+        }
30
+    }
31
+
32
+    /**
33
+     * Push a new Context frame onto the stack.
34
+     *
35
+     * @param mixed $value Object or array to use for context
36
+     */
37
+    public function push($value)
38
+    {
39
+        array_push($this->stack, $value);
40
+    }
41
+
42
+    /**
43
+     * Push a new Context frame onto the block context stack.
44
+     *
45
+     * @param mixed $value Object or array to use for block context
46
+     */
47
+    public function pushBlockContext($value)
48
+    {
49
+        array_push($this->blockStack, $value);
50
+    }
51
+
52
+    /**
53
+     * Pop the last Context frame from the stack.
54
+     *
55
+     * @return mixed Last Context frame (object or array)
56
+     */
57
+    public function pop()
58
+    {
59
+        return array_pop($this->stack);
60
+    }
61
+
62
+    /**
63
+     * Pop the last block Context frame from the stack.
64
+     *
65
+     * @return mixed Last block Context frame (object or array)
66
+     */
67
+    public function popBlockContext()
68
+    {
69
+        return array_pop($this->blockStack);
70
+    }
71
+
72
+    /**
73
+     * Get the last Context frame.
74
+     *
75
+     * @return mixed Last Context frame (object or array)
76
+     */
77
+    public function last()
78
+    {
79
+        return end($this->stack);
80
+    }
81
+
82
+    /**
83
+     * Find a variable in the Context stack.
84
+     *
85
+     * Starting with the last Context frame (the context of the innermost section), and working back to the top-level
86
+     * rendering context, look for a variable with the given name:
87
+     *
88
+     *  * If the Context frame is an associative array which contains the key $id, returns the value of that element.
89
+     *  * If the Context frame is an object, this will check first for a public method, then a public property named
90
+     *    $id. Failing both of these, it will try `__isset` and `__get` magic methods.
91
+     *  * If a value named $id is not found in any Context frame, returns an empty string.
92
+     *
93
+     * @param string $id Variable name
94
+     *
95
+     * @return mixed Variable value, or '' if not found
96
+     */
97
+    public function find($id)
98
+    {
99
+        return $this->findVariableInStack($id, $this->stack);
100
+    }
101
+
102
+    /**
103
+     * Find a 'dot notation' variable in the Context stack.
104
+     *
105
+     * Note that dot notation traversal bubbles through scope differently than the regular find method. After finding
106
+     * the initial chunk of the dotted name, each subsequent chunk is searched for only within the value of the previous
107
+     * result. For example, given the following context stack:
108
+     *
109
+     *     $data = array(
110
+     *         'name' => 'Fred',
111
+     *         'child' => array(
112
+     *             'name' => 'Bob'
113
+     *         ),
114
+     *     );
115
+     *
116
+     * ... and the Mustache following template:
117
+     *
118
+     *     {{ child.name }}
119
+     *
120
+     * ... the `name` value is only searched for within the `child` value of the global Context, not within parent
121
+     * Context frames.
122
+     *
123
+     * @param string $id Dotted variable selector
124
+     *
125
+     * @return mixed Variable value, or '' if not found
126
+     */
127
+    public function findDot($id)
128
+    {
129
+        $chunks = explode('.', $id);
130
+        $first  = array_shift($chunks);
131
+        $value  = $this->findVariableInStack($first, $this->stack);
132
+
133
+        foreach ($chunks as $chunk) {
134
+            if ($value === '') {
135
+                return $value;
136
+            }
137
+
138
+            $value = $this->findVariableInStack($chunk, array($value));
139
+        }
140
+
141
+        return $value;
142
+    }
143
+
144
+    /**
145
+     * Find an 'anchored dot notation' variable in the Context stack.
146
+     *
147
+     * This is the same as findDot(), except it looks in the top of the context
148
+     * stack for the first value, rather than searching the whole context stack
149
+     * and starting from there.
150
+     *
151
+     * @see Mustache_Context::findDot
152
+     *
153
+     * @throws Mustache_Exception_InvalidArgumentException if given an invalid anchored dot $id.
154
+     *
155
+     * @param string $id Dotted variable selector
156
+     *
157
+     * @return mixed Variable value, or '' if not found
158
+     */
159
+    public function findAnchoredDot($id)
160
+    {
161
+        $chunks = explode('.', $id);
162
+        $first  = array_shift($chunks);
163
+        if ($first !== '') {
164
+            throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected id for findAnchoredDot: %s', $id));
165
+        }
166
+
167
+        $value  = $this->last();
168
+
169
+        foreach ($chunks as $chunk) {
170
+            if ($value === '') {
171
+                return $value;
172
+            }
173
+
174
+            $value = $this->findVariableInStack($chunk, array($value));
175
+        }
176
+
177
+        return $value;
178
+    }
179
+
180
+    /**
181
+     * Find an argument in the block context stack.
182
+     *
183
+     * @param string $id
184
+     *
185
+     * @return mixed Variable value, or '' if not found.
186
+     */
187
+    public function findInBlock($id)
188
+    {
189
+        foreach ($this->blockStack as $context) {
190
+            if (array_key_exists($id, $context)) {
191
+                return $context[$id];
192
+            }
193
+        }
194
+
195
+        return '';
196
+    }
197
+
198
+    /**
199
+     * Helper function to find a variable in the Context stack.
200
+     *
201
+     * @see Mustache_Context::find
202
+     *
203
+     * @param string $id    Variable name
204
+     * @param array  $stack Context stack
205
+     *
206
+     * @return mixed Variable value, or '' if not found
207
+     */
208
+    private function findVariableInStack($id, array $stack)
209
+    {
210
+        for ($i = count($stack) - 1; $i >= 0; $i--) {
211
+            $frame = &$stack[$i];
212
+
213
+            switch (gettype($frame)) {
214
+                case 'object':
215
+                    if (!($frame instanceof Closure)) {
216
+                        // Note that is_callable() *will not work here*
217
+                        // See https://github.com/bobthecow/mustache.php/wiki/Magic-Methods
218
+                        if (method_exists($frame, $id)) {
219
+                            return $frame->$id();
220
+                        }
221
+
222
+                        if (isset($frame->$id)) {
223
+                            return $frame->$id;
224
+                        }
225
+
226
+                        if ($frame instanceof ArrayAccess && isset($frame[$id])) {
227
+                            return $frame[$id];
228
+                        }
229
+                    }
230
+                    break;
231
+
232
+                case 'array':
233
+                    if (array_key_exists($id, $frame)) {
234
+                        return $frame[$id];
235
+                    }
236
+                    break;
237
+            }
238
+        }
239
+
240
+        return '';
241
+    }
242
+}

+ 787
- 0
plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Engine.php Переглянути файл

@@ -0,0 +1,787 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2015 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+/**
13
+ * A Mustache implementation in PHP.
14
+ *
15
+ * {@link http://defunkt.github.com/mustache}
16
+ *
17
+ * Mustache is a framework-agnostic logic-less templating language. It enforces separation of view
18
+ * logic from template files. In fact, it is not even possible to embed logic in the template.
19
+ *
20
+ * This is very, very rad.
21
+ *
22
+ * @author Justin Hileman {@link http://justinhileman.com}
23
+ */
24
+class Mustache_Engine
25
+{
26
+    const VERSION        = '2.9.0';
27
+    const SPEC_VERSION   = '1.1.2';
28
+
29
+    const PRAGMA_FILTERS      = 'FILTERS';
30
+    const PRAGMA_BLOCKS       = 'BLOCKS';
31
+    const PRAGMA_ANCHORED_DOT = 'ANCHORED-DOT';
32
+
33
+    // Known pragmas
34
+    private static $knownPragmas = array(
35
+        self::PRAGMA_FILTERS      => true,
36
+        self::PRAGMA_BLOCKS       => true,
37
+        self::PRAGMA_ANCHORED_DOT => true,
38
+    );
39
+
40
+    // Template cache
41
+    private $templates = array();
42
+
43
+    // Environment
44
+    private $templateClassPrefix = '__Mustache_';
45
+    private $cache;
46
+    private $lambdaCache;
47
+    private $cacheLambdaTemplates = false;
48
+    private $loader;
49
+    private $partialsLoader;
50
+    private $helpers;
51
+    private $escape;
52
+    private $entityFlags = ENT_COMPAT;
53
+    private $charset = 'UTF-8';
54
+    private $logger;
55
+    private $strictCallables = false;
56
+    private $pragmas = array();
57
+
58
+    // Services
59
+    private $tokenizer;
60
+    private $parser;
61
+    private $compiler;
62
+
63
+    /**
64
+     * Mustache class constructor.
65
+     *
66
+     * Passing an $options array allows overriding certain Mustache options during instantiation:
67
+     *
68
+     *     $options = array(
69
+     *         // The class prefix for compiled templates. Defaults to '__Mustache_'.
70
+     *         'template_class_prefix' => '__MyTemplates_',
71
+     *
72
+     *         // A Mustache cache instance or a cache directory string for compiled templates.
73
+     *         // Mustache will not cache templates unless this is set.
74
+     *         'cache' => dirname(__FILE__).'/tmp/cache/mustache',
75
+     *
76
+     *         // Override default permissions for cache files. Defaults to using the system-defined umask. It is
77
+     *         // *strongly* recommended that you configure your umask properly rather than overriding permissions here.
78
+     *         'cache_file_mode' => 0666,
79
+     *
80
+     *         // Optionally, enable caching for lambda section templates. This is generally not recommended, as lambda
81
+     *         // sections are often too dynamic to benefit from caching.
82
+     *         'cache_lambda_templates' => true,
83
+     *
84
+     *         // A Mustache template loader instance. Uses a StringLoader if not specified.
85
+     *         'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
86
+     *
87
+     *         // A Mustache loader instance for partials.
88
+     *         'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'),
89
+     *
90
+     *         // An array of Mustache partials. Useful for quick-and-dirty string template loading, but not as
91
+     *         // efficient or lazy as a Filesystem (or database) loader.
92
+     *         'partials' => array('foo' => file_get_contents(dirname(__FILE__).'/views/partials/foo.mustache')),
93
+     *
94
+     *         // An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order
95
+     *         // sections), or any other valid Mustache context value. They will be prepended to the context stack,
96
+     *         // so they will be available in any template loaded by this Mustache instance.
97
+     *         'helpers' => array('i18n' => function ($text) {
98
+     *             // do something translatey here...
99
+     *         }),
100
+     *
101
+     *         // An 'escape' callback, responsible for escaping double-mustache variables.
102
+     *         'escape' => function ($value) {
103
+     *             return htmlspecialchars($buffer, ENT_COMPAT, 'UTF-8');
104
+     *         },
105
+     *
106
+     *         // Type argument for `htmlspecialchars`.  Defaults to ENT_COMPAT.  You may prefer ENT_QUOTES.
107
+     *         'entity_flags' => ENT_QUOTES,
108
+     *
109
+     *         // Character set for `htmlspecialchars`. Defaults to 'UTF-8'. Use 'UTF-8'.
110
+     *         'charset' => 'ISO-8859-1',
111
+     *
112
+     *         // A Mustache Logger instance. No logging will occur unless this is set. Using a PSR-3 compatible
113
+     *         // logging library -- such as Monolog -- is highly recommended. A simple stream logger implementation is
114
+     *         // available as well:
115
+     *         'logger' => new Mustache_Logger_StreamLogger('php://stderr'),
116
+     *
117
+     *         // Only treat Closure instances and invokable classes as callable. If true, values like
118
+     *         // `array('ClassName', 'methodName')` and `array($classInstance, 'methodName')`, which are traditionally
119
+     *         // "callable" in PHP, are not called to resolve variables for interpolation or section contexts. This
120
+     *         // helps protect against arbitrary code execution when user input is passed directly into the template.
121
+     *         // This currently defaults to false, but will default to true in v3.0.
122
+     *         'strict_callables' => true,
123
+     *
124
+     *         // Enable pragmas across all templates, regardless of the presence of pragma tags in the individual
125
+     *         // templates.
126
+     *         'pragmas' => [Mustache_Engine::PRAGMA_FILTERS],
127
+     *     );
128
+     *
129
+     * @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable.
130
+     *
131
+     * @param array $options (default: array())
132
+     */
133
+    public function __construct(array $options = array())
134
+    {
135
+        if (isset($options['template_class_prefix'])) {
136
+            $this->templateClassPrefix = $options['template_class_prefix'];
137
+        }
138
+
139
+        if (isset($options['cache'])) {
140
+            $cache = $options['cache'];
141
+
142
+            if (is_string($cache)) {
143
+                $mode  = isset($options['cache_file_mode']) ? $options['cache_file_mode'] : null;
144
+                $cache = new Mustache_Cache_FilesystemCache($cache, $mode);
145
+            }
146
+
147
+            $this->setCache($cache);
148
+        }
149
+
150
+        if (isset($options['cache_lambda_templates'])) {
151
+            $this->cacheLambdaTemplates = (bool) $options['cache_lambda_templates'];
152
+        }
153
+
154
+        if (isset($options['loader'])) {
155
+            $this->setLoader($options['loader']);
156
+        }
157
+
158
+        if (isset($options['partials_loader'])) {
159
+            $this->setPartialsLoader($options['partials_loader']);
160
+        }
161
+
162
+        if (isset($options['partials'])) {
163
+            $this->setPartials($options['partials']);
164
+        }
165
+
166
+        if (isset($options['helpers'])) {
167
+            $this->setHelpers($options['helpers']);
168
+        }
169
+
170
+        if (isset($options['escape'])) {
171
+            if (!is_callable($options['escape'])) {
172
+                throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "escape" option must be callable');
173
+            }
174
+
175
+            $this->escape = $options['escape'];
176
+        }
177
+
178
+        if (isset($options['entity_flags'])) {
179
+            $this->entityFlags = $options['entity_flags'];
180
+        }
181
+
182
+        if (isset($options['charset'])) {
183
+            $this->charset = $options['charset'];
184
+        }
185
+
186
+        if (isset($options['logger'])) {
187
+            $this->setLogger($options['logger']);
188
+        }
189
+
190
+        if (isset($options['strict_callables'])) {
191
+            $this->strictCallables = $options['strict_callables'];
192
+        }
193
+
194
+        if (isset($options['pragmas'])) {
195
+            foreach ($options['pragmas'] as $pragma) {
196
+                if (!isset(self::$knownPragmas[$pragma])) {
197
+                    throw new Mustache_Exception_InvalidArgumentException(sprintf('Unknown pragma: "%s".', $pragma));
198
+                }
199
+                $this->pragmas[$pragma] = true;
200
+            }
201
+        }
202
+    }
203
+
204
+    /**
205
+     * Shortcut 'render' invocation.
206
+     *
207
+     * Equivalent to calling `$mustache->loadTemplate($template)->render($context);`
208
+     *
209
+     * @see Mustache_Engine::loadTemplate
210
+     * @see Mustache_Template::render
211
+     *
212
+     * @param string $template
213
+     * @param mixed  $context  (default: array())
214
+     *
215
+     * @return string Rendered template
216
+     */
217
+    public function render($template, $context = array())
218
+    {
219
+        return $this->loadTemplate($template)->render($context);
220
+    }
221
+
222
+    /**
223
+     * Get the current Mustache escape callback.
224
+     *
225
+     * @return callable|null
226
+     */
227
+    public function getEscape()
228
+    {
229
+        return $this->escape;
230
+    }
231
+
232
+    /**
233
+     * Get the current Mustache entitity type to escape.
234
+     *
235
+     * @return int
236
+     */
237
+    public function getEntityFlags()
238
+    {
239
+        return $this->entityFlags;
240
+    }
241
+
242
+    /**
243
+     * Get the current Mustache character set.
244
+     *
245
+     * @return string
246
+     */
247
+    public function getCharset()
248
+    {
249
+        return $this->charset;
250
+    }
251
+
252
+    /**
253
+     * Get the current globally enabled pragmas.
254
+     *
255
+     * @return array
256
+     */
257
+    public function getPragmas()
258
+    {
259
+        return array_keys($this->pragmas);
260
+    }
261
+
262
+    /**
263
+     * Set the Mustache template Loader instance.
264
+     *
265
+     * @param Mustache_Loader $loader
266
+     */
267
+    public function setLoader(Mustache_Loader $loader)
268
+    {
269
+        $this->loader = $loader;
270
+    }
271
+
272
+    /**
273
+     * Get the current Mustache template Loader instance.
274
+     *
275
+     * If no Loader instance has been explicitly specified, this method will instantiate and return
276
+     * a StringLoader instance.
277
+     *
278
+     * @return Mustache_Loader
279
+     */
280
+    public function getLoader()
281
+    {
282
+        if (!isset($this->loader)) {
283
+            $this->loader = new Mustache_Loader_StringLoader();
284
+        }
285
+
286
+        return $this->loader;
287
+    }
288
+
289
+    /**
290
+     * Set the Mustache partials Loader instance.
291
+     *
292
+     * @param Mustache_Loader $partialsLoader
293
+     */
294
+    public function setPartialsLoader(Mustache_Loader $partialsLoader)
295
+    {
296
+        $this->partialsLoader = $partialsLoader;
297
+    }
298
+
299
+    /**
300
+     * Get the current Mustache partials Loader instance.
301
+     *
302
+     * If no Loader instance has been explicitly specified, this method will instantiate and return
303
+     * an ArrayLoader instance.
304
+     *
305
+     * @return Mustache_Loader
306
+     */
307
+    public function getPartialsLoader()
308
+    {
309
+        if (!isset($this->partialsLoader)) {
310
+            $this->partialsLoader = new Mustache_Loader_ArrayLoader();
311
+        }
312
+
313
+        return $this->partialsLoader;
314
+    }
315
+
316
+    /**
317
+     * Set partials for the current partials Loader instance.
318
+     *
319
+     * @throws Mustache_Exception_RuntimeException If the current Loader instance is immutable
320
+     *
321
+     * @param array $partials (default: array())
322
+     */
323
+    public function setPartials(array $partials = array())
324
+    {
325
+        if (!isset($this->partialsLoader)) {
326
+            $this->partialsLoader = new Mustache_Loader_ArrayLoader();
327
+        }
328
+
329
+        if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) {
330
+            throw new Mustache_Exception_RuntimeException('Unable to set partials on an immutable Mustache Loader instance');
331
+        }
332
+
333
+        $this->partialsLoader->setTemplates($partials);
334
+    }
335
+
336
+    /**
337
+     * Set an array of Mustache helpers.
338
+     *
339
+     * An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order sections), or
340
+     * any other valid Mustache context value. They will be prepended to the context stack, so they will be available in
341
+     * any template loaded by this Mustache instance.
342
+     *
343
+     * @throws Mustache_Exception_InvalidArgumentException if $helpers is not an array or Traversable
344
+     *
345
+     * @param array|Traversable $helpers
346
+     */
347
+    public function setHelpers($helpers)
348
+    {
349
+        if (!is_array($helpers) && !$helpers instanceof Traversable) {
350
+            throw new Mustache_Exception_InvalidArgumentException('setHelpers expects an array of helpers');
351
+        }
352
+
353
+        $this->getHelpers()->clear();
354
+
355
+        foreach ($helpers as $name => $helper) {
356
+            $this->addHelper($name, $helper);
357
+        }
358
+    }
359
+
360
+    /**
361
+     * Get the current set of Mustache helpers.
362
+     *
363
+     * @see Mustache_Engine::setHelpers
364
+     *
365
+     * @return Mustache_HelperCollection
366
+     */
367
+    public function getHelpers()
368
+    {
369
+        if (!isset($this->helpers)) {
370
+            $this->helpers = new Mustache_HelperCollection();
371
+        }
372
+
373
+        return $this->helpers;
374
+    }
375
+
376
+    /**
377
+     * Add a new Mustache helper.
378
+     *
379
+     * @see Mustache_Engine::setHelpers
380
+     *
381
+     * @param string $name
382
+     * @param mixed  $helper
383
+     */
384
+    public function addHelper($name, $helper)
385
+    {
386
+        $this->getHelpers()->add($name, $helper);
387
+    }
388
+
389
+    /**
390
+     * Get a Mustache helper by name.
391
+     *
392
+     * @see Mustache_Engine::setHelpers
393
+     *
394
+     * @param string $name
395
+     *
396
+     * @return mixed Helper
397
+     */
398
+    public function getHelper($name)
399
+    {
400
+        return $this->getHelpers()->get($name);
401
+    }
402
+
403
+    /**
404
+     * Check whether this Mustache instance has a helper.
405
+     *
406
+     * @see Mustache_Engine::setHelpers
407
+     *
408
+     * @param string $name
409
+     *
410
+     * @return bool True if the helper is present
411
+     */
412
+    public function hasHelper($name)
413
+    {
414
+        return $this->getHelpers()->has($name);
415
+    }
416
+
417
+    /**
418
+     * Remove a helper by name.
419
+     *
420
+     * @see Mustache_Engine::setHelpers
421
+     *
422
+     * @param string $name
423
+     */
424
+    public function removeHelper($name)
425
+    {
426
+        $this->getHelpers()->remove($name);
427
+    }
428
+
429
+    /**
430
+     * Set the Mustache Logger instance.
431
+     *
432
+     * @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface.
433
+     *
434
+     * @param Mustache_Logger|Psr\Log\LoggerInterface $logger
435
+     */
436
+    public function setLogger($logger = null)
437
+    {
438
+        if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) {
439
+            throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.');
440
+        }
441
+
442
+        if ($this->getCache()->getLogger() === null) {
443
+            $this->getCache()->setLogger($logger);
444
+        }
445
+
446
+        $this->logger = $logger;
447
+    }
448
+
449
+    /**
450
+     * Get the current Mustache Logger instance.
451
+     *
452
+     * @return Mustache_Logger|Psr\Log\LoggerInterface
453
+     */
454
+    public function getLogger()
455
+    {
456
+        return $this->logger;
457
+    }
458
+
459
+    /**
460
+     * Set the Mustache Tokenizer instance.
461
+     *
462
+     * @param Mustache_Tokenizer $tokenizer
463
+     */
464
+    public function setTokenizer(Mustache_Tokenizer $tokenizer)
465
+    {
466
+        $this->tokenizer = $tokenizer;
467
+    }
468
+
469
+    /**
470
+     * Get the current Mustache Tokenizer instance.
471
+     *
472
+     * If no Tokenizer instance has been explicitly specified, this method will instantiate and return a new one.
473
+     *
474
+     * @return Mustache_Tokenizer
475
+     */
476
+    public function getTokenizer()
477
+    {
478
+        if (!isset($this->tokenizer)) {
479
+            $this->tokenizer = new Mustache_Tokenizer();
480
+        }
481
+
482
+        return $this->tokenizer;
483
+    }
484
+
485
+    /**
486
+     * Set the Mustache Parser instance.
487
+     *
488
+     * @param Mustache_Parser $parser
489
+     */
490
+    public function setParser(Mustache_Parser $parser)
491
+    {
492
+        $this->parser = $parser;
493
+    }
494
+
495
+    /**
496
+     * Get the current Mustache Parser instance.
497
+     *
498
+     * If no Parser instance has been explicitly specified, this method will instantiate and return a new one.
499
+     *
500
+     * @return Mustache_Parser
501
+     */
502
+    public function getParser()
503
+    {
504
+        if (!isset($this->parser)) {
505
+            $this->parser = new Mustache_Parser();
506
+        }
507
+
508
+        return $this->parser;
509
+    }
510
+
511
+    /**
512
+     * Set the Mustache Compiler instance.
513
+     *
514
+     * @param Mustache_Compiler $compiler
515
+     */
516
+    public function setCompiler(Mustache_Compiler $compiler)
517
+    {
518
+        $this->compiler = $compiler;
519
+    }
520
+
521
+    /**
522
+     * Get the current Mustache Compiler instance.
523
+     *
524
+     * If no Compiler instance has been explicitly specified, this method will instantiate and return a new one.
525
+     *
526
+     * @return Mustache_Compiler
527
+     */
528
+    public function getCompiler()
529
+    {
530
+        if (!isset($this->compiler)) {
531
+            $this->compiler = new Mustache_Compiler();
532
+        }
533
+
534
+        return $this->compiler;
535
+    }
536
+
537
+    /**
538
+     * Set the Mustache Cache instance.
539
+     *
540
+     * @param Mustache_Cache $cache
541
+     */
542
+    public function setCache(Mustache_Cache $cache)
543
+    {
544
+        if (isset($this->logger) && $cache->getLogger() === null) {
545
+            $cache->setLogger($this->getLogger());
546
+        }
547
+
548
+        $this->cache = $cache;
549
+    }
550
+
551
+    /**
552
+     * Get the current Mustache Cache instance.
553
+     *
554
+     * If no Cache instance has been explicitly specified, this method will instantiate and return a new one.
555
+     *
556
+     * @return Mustache_Cache
557
+     */
558
+    public function getCache()
559
+    {
560
+        if (!isset($this->cache)) {
561
+            $this->setCache(new Mustache_Cache_NoopCache());
562
+        }
563
+
564
+        return $this->cache;
565
+    }
566
+
567
+    /**
568
+     * Get the current Lambda Cache instance.
569
+     *
570
+     * If 'cache_lambda_templates' is enabled, this is the default cache instance. Otherwise, it is a NoopCache.
571
+     *
572
+     * @see Mustache_Engine::getCache
573
+     *
574
+     * @return Mustache_Cache
575
+     */
576
+    protected function getLambdaCache()
577
+    {
578
+        if ($this->cacheLambdaTemplates) {
579
+            return $this->getCache();
580
+        }
581
+
582
+        if (!isset($this->lambdaCache)) {
583
+            $this->lambdaCache = new Mustache_Cache_NoopCache();
584
+        }
585
+
586
+        return $this->lambdaCache;
587
+    }
588
+
589
+    /**
590
+     * Helper method to generate a Mustache template class.
591
+     *
592
+     * @param string $source
593
+     *
594
+     * @return string Mustache Template class name
595
+     */
596
+    public function getTemplateClassName($source)
597
+    {
598
+        return $this->templateClassPrefix . md5(sprintf(
599
+            'version:%s,escape:%s,entity_flags:%i,charset:%s,strict_callables:%s,pragmas:%s,source:%s',
600
+            self::VERSION,
601
+            isset($this->escape) ? 'custom' : 'default',
602
+            $this->entityFlags,
603
+            $this->charset,
604
+            $this->strictCallables ? 'true' : 'false',
605
+            implode(' ', $this->getPragmas()),
606
+            $source
607
+        ));
608
+    }
609
+
610
+    /**
611
+     * Load a Mustache Template by name.
612
+     *
613
+     * @param string $name
614
+     *
615
+     * @return Mustache_Template
616
+     */
617
+    public function loadTemplate($name)
618
+    {
619
+        return $this->loadSource($this->getLoader()->load($name));
620
+    }
621
+
622
+    /**
623
+     * Load a Mustache partial Template by name.
624
+     *
625
+     * This is a helper method used internally by Template instances for loading partial templates. You can most likely
626
+     * ignore it completely.
627
+     *
628
+     * @param string $name
629
+     *
630
+     * @return Mustache_Template
631
+     */
632
+    public function loadPartial($name)
633
+    {
634
+        try {
635
+            if (isset($this->partialsLoader)) {
636
+                $loader = $this->partialsLoader;
637
+            } elseif (isset($this->loader) && !$this->loader instanceof Mustache_Loader_StringLoader) {
638
+                $loader = $this->loader;
639
+            } else {
640
+                throw new Mustache_Exception_UnknownTemplateException($name);
641
+            }
642
+
643
+            return $this->loadSource($loader->load($name));
644
+        } catch (Mustache_Exception_UnknownTemplateException $e) {
645
+            // If the named partial cannot be found, log then return null.
646
+            $this->log(
647
+                Mustache_Logger::WARNING,
648
+                'Partial not found: "{name}"',
649
+                array('name' => $e->getTemplateName())
650
+            );
651
+        }
652
+    }
653
+
654
+    /**
655
+     * Load a Mustache lambda Template by source.
656
+     *
657
+     * This is a helper method used by Template instances to generate subtemplates for Lambda sections. You can most
658
+     * likely ignore it completely.
659
+     *
660
+     * @param string $source
661
+     * @param string $delims (default: null)
662
+     *
663
+     * @return Mustache_Template
664
+     */
665
+    public function loadLambda($source, $delims = null)
666
+    {
667
+        if ($delims !== null) {
668
+            $source = $delims . "\n" . $source;
669
+        }
670
+
671
+        return $this->loadSource($source, $this->getLambdaCache());
672
+    }
673
+
674
+    /**
675
+     * Instantiate and return a Mustache Template instance by source.
676
+     *
677
+     * Optionally provide a Mustache_Cache instance. This is used internally by Mustache_Engine::loadLambda to respect
678
+     * the 'cache_lambda_templates' configuration option.
679
+     *
680
+     * @see Mustache_Engine::loadTemplate
681
+     * @see Mustache_Engine::loadPartial
682
+     * @see Mustache_Engine::loadLambda
683
+     *
684
+     * @param string         $source
685
+     * @param Mustache_Cache $cache  (default: null)
686
+     *
687
+     * @return Mustache_Template
688
+     */
689
+    private function loadSource($source, Mustache_Cache $cache = null)
690
+    {
691
+        $className = $this->getTemplateClassName($source);
692
+
693
+        if (!isset($this->templates[$className])) {
694
+            if ($cache === null) {
695
+                $cache = $this->getCache();
696
+            }
697
+
698
+            if (!class_exists($className, false)) {
699
+                if (!$cache->load($className)) {
700
+                    $compiled = $this->compile($source);
701
+                    $cache->cache($className, $compiled);
702
+                }
703
+            }
704
+
705
+            $this->log(
706
+                Mustache_Logger::DEBUG,
707
+                'Instantiating template: "{className}"',
708
+                array('className' => $className)
709
+            );
710
+
711
+            $this->templates[$className] = new $className($this);
712
+        }
713
+
714
+        return $this->templates[$className];
715
+    }
716
+
717
+    /**
718
+     * Helper method to tokenize a Mustache template.
719
+     *
720
+     * @see Mustache_Tokenizer::scan
721
+     *
722
+     * @param string $source
723
+     *
724
+     * @return array Tokens
725
+     */
726
+    private function tokenize($source)
727
+    {
728
+        return $this->getTokenizer()->scan($source);
729
+    }
730
+
731
+    /**
732
+     * Helper method to parse a Mustache template.
733
+     *
734
+     * @see Mustache_Parser::parse
735
+     *
736
+     * @param string $source
737
+     *
738
+     * @return array Token tree
739
+     */
740
+    private function parse($source)
741
+    {
742
+        $parser = $this->getParser();
743
+        $parser->setPragmas($this->getPragmas());
744
+
745
+        return $parser->parse($this->tokenize($source));
746
+    }
747
+
748
+    /**
749
+     * Helper method to compile a Mustache template.
750
+     *
751
+     * @see Mustache_Compiler::compile
752
+     *
753
+     * @param string $source
754
+     *
755
+     * @return string generated Mustache template class code
756
+     */
757
+    private function compile($source)
758
+    {
759
+        $tree = $this->parse($source);
760
+        $name = $this->getTemplateClassName($source);
761
+
762
+        $this->log(
763
+            Mustache_Logger::INFO,
764
+            'Compiling template to "{className}" class',
765
+            array('className' => $name)
766
+        );
767
+
768
+        $compiler = $this->getCompiler();
769
+        $compiler->setPragmas($this->getPragmas());
770
+
771
+        return $compiler->compile($source, $tree, $name, isset($this->escape), $this->charset, $this->strictCallables, $this->entityFlags);
772
+    }
773
+
774
+    /**
775
+     * Add a log record if logging is enabled.
776
+     *
777
+     * @param int    $level   The logging level
778
+     * @param string $message The log message
779
+     * @param array  $context The log context
780
+     */
781
+    private function log($level, $message, array $context = array())
782
+    {
783
+        if (isset($this->logger)) {
784
+            $this->logger->log($level, $message, $context);
785
+        }
786
+    }
787
+}

+ 18
- 0
plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Exception.php Переглянути файл

@@ -0,0 +1,18 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2015 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+/**
13
+ * A Mustache Exception interface.
14
+ */
15
+interface Mustache_Exception
16
+{
17
+    // This space intentionally left blank.
18
+}

+ 0
- 0
plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Exception/InvalidArgumentException.php Переглянути файл


Деякі файли не було показано, через те що забагато файлів було змінено

Завантаження…
Відмінити
Зберегти