-
Notifications
You must be signed in to change notification settings - Fork 0
/
multisite-language-switcher-stubs.php
5520 lines (5519 loc) · 175 KB
/
multisite-language-switcher-stubs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
namespace lloc\Msls {
/**
* Abstraction for the hook classes
*
* @package Msls
*/
class MslsMain
{
/**
* Instance of options
*
* @var MslsOptions
*/
protected $options;
/**
* Collection of blog objects
*
* @var MslsBlogCollection
*/
protected $collection;
/**
* Constructor
*
* @param MslsOptions $options
* @param MslsBlogCollection $collection
*/
public final function __construct(\lloc\Msls\MslsOptions $options, \lloc\Msls\MslsBlogCollection $collection)
{
}
public static function create() : object
{
}
/**
* Prints a message in the error log if WP_DEBUG is true
*
* @param mixed $message
*/
public function debugger($message) : void
{
}
/**
* Get the input array
*
* @param int $object_id
*
* @return array<string, int>
*/
public function get_input_array($object_id) : array
{
}
/**
* Checks if the current input comes from the autosave-functionality
*
* @param int $post_id
*
* @return bool
*/
public function is_autosave($post_id) : bool
{
}
/**
* Checks for the nonce in the INPUT_POST
*
* @return boolean
*/
public function verify_nonce() : bool
{
}
/**
* Delete
*
* @param int $object_id
*
* @codeCoverageIgnore
*/
public function delete($object_id) : void
{
}
/**
* Save
*
* @param int $object_id
* @param string $class_name
*
* @codeCoverageIgnore
*/
protected function save($object_id, $class_name) : void
{
}
}
/**
* Handling of existing/not existing translations in the backend listings of
* various post types
*
* @package Msls
*/
class MslsCustomColumn extends \lloc\Msls\MslsMain
{
public static function init() : void
{
}
protected function add_hooks() : void
{
}
/**
* Table header
*
* @param string[] $columns
*
* @return string[]
*/
public function th(array $columns)
{
}
/**
* Table body
*
* @param string $column_name
* @param int $item_id
*/
public function td($column_name, $item_id) : void
{
}
}
/**
* Handling of existing/not existing translations in the backend
* listings of various taxonomies
*
* @package Msls
*/
final class MslsCustomColumnTaxonomy extends \lloc\Msls\MslsCustomColumn
{
/**
* @param string $deprecated
* @param string $column_name
* @param int $item_id
*/
public function column_default($deprecated, $column_name, $item_id) : void
{
}
/**
* @codeCoverageIgnore
*
* @param int $object_id
*/
public function delete($object_id) : void
{
}
}
/**
* Adding custom filter to posts/pages table.
*
* @package Msls
*/
final class MslsCustomFilter extends \lloc\Msls\MslsMain
{
/**
* @codeCoverageIgnore
*/
public static function init() : void
{
}
/**
* Echo's select tag with list of blogs
*
* @uses selected
*/
public function add_filter() : void
{
}
/**
* Executes filter, excludes translated posts from WP_Query
*
* @param \WP_Query $query
*
* @return bool|\WP_Query
*/
public function execute_filter(\WP_Query $query)
{
}
}
class MslsBlock
{
protected \lloc\Msls\MslsOptions $options;
public function __construct(\lloc\Msls\MslsOptions $options)
{
}
/**
* @codeCoverageIgnore
*/
public static function init() : void
{
}
/**
* Register block and shortcode.
*/
public function register_block() : bool
{
}
}
/**
* Class MslsRegistryInstance
*
* @package lloc\Msls
*/
class MslsRegistryInstance
{
/**
* Gets or creates an instance of the called class
*
* @return static
*/
public static function instance()
{
}
}
/**
* Generic class for overloading properties
*
* @example https://gist.githubusercontent.com/lloc/2c232cef3f910acf692f/raw/f4eb70f4b1f8dc90c212d85d65af40c6604a32b9/MslsGetSet.php
*
* @package Msls
*/
class MslsGetSet extends \lloc\Msls\MslsRegistryInstance
{
/**
* @var array<string, mixed>
*/
protected $arr = array();
/**
* Overloads the set method.
*
* @param string $key
* @param mixed $value
*/
public function __set($key, $value)
{
}
/**
* Overloads the get method.
*
* @param string $key
*
* @return mixed
*/
public function __get($key)
{
}
/**
* Overloads the isset method.
*
* @param string $key
*
* @return bool
*/
public function __isset($key)
{
}
/**
* Overloads the unset method.
*
* @param string $key
*/
public function __unset($key)
{
}
/**
* Resets the properties container to an empty array.
*
* @return MslsGetSet
*/
public function reset()
{
}
/**
* Checks if the array has a non-empty item with the specified key name.
*
* This is method is similar to the overloaded __isset-method since
* __set cleans empty properties, but I use for example
*
* $obj->has_value( $temp )
*
* and not
*
* isset( $obj->$temp )
*
* which is the same but in my opinion a little bit ugly.
*
* @param string $key
*
* @return bool
*/
public function has_value(string $key) : bool
{
}
/**
* Checks if the properties-container is empty.
*
* @return bool
*/
public function is_empty()
{
}
/**
* Gets the complete properties-container as an array.
*
* @return array<string, mixed>
*/
public function get_arr() : array
{
}
}
/**
* General options class
*
* @package Msls
* @property bool $activate_content_import
* @property bool $activate_autocomplete
* @property bool $output_current_blog
* @property int $display
* @property int $reference_user
* @property int $content_priority
* @property string $admin_display
* @property string $admin_language
* @property string $description
* @property string $before_item
* @property string $after_item
* @property string $before_output
* @property string $after_output
*/
class MslsOptions extends \lloc\Msls\MslsGetSet
{
public const PREFIX = 'msls';
public const SEPARATOR = '';
protected string $name;
protected bool $exists = false;
protected bool $autoload = true;
/**
* @var array<int, mixed>
*/
protected array $args;
/**
* Rewrite with front
*
* @var bool
*/
public ?bool $with_front = null;
/**
* Factory method
*
* @codeCoverageIgnore
*
* @param int $id
*
* @return MslsOptions
*/
public static function create($id = 0)
{
}
/**
* Determines if the current page is the main page (front page, search, 404).
*
* @return boolean
*/
public static function is_main_page()
{
}
/**
* Determines if the current page is a category, tag or taxonomy page.
*
* @return boolean
*/
public static function is_tax_page()
{
}
/**
* Determines if the current page is an archive page for a date, author, or any other post type.
*
* @return boolean
*/
public static function is_query_page()
{
}
/**
* Constructor
*/
public function __construct()
{
}
public function get_option_name() : string
{
}
/**
* Gets an element of arg by index
*
* The returned value will either be cast to the type of `$default` or, if nothing is set at this index, it will be the value of `$default`.
*
* @param int $index
* @param mixed $default
*
* @return mixed
*/
public function get_arg(int $index, $default = null)
{
}
/**
* @param mixed $arr
*/
public function save($arr) : void
{
}
public function delete() : void
{
}
/**
* @param mixed $arr
*
* @return bool
*/
public function set($arr) : bool
{
}
/**
* @param string $language
*
* @return string
*/
public function get_permalink($language)
{
}
/**
* Get postlink
*
* @param string $language
*
* @return string
*/
public function get_postlink($language)
{
}
/**
* Get the queried taxonomy
*
* @return string
*/
public function get_tax_query()
{
}
/**
* Get current link
*
* @return string
*/
public function get_current_link()
{
}
/**
* Is excluded
*
* @return bool
*/
public function is_excluded()
{
}
/**
* Is content
*
* @return bool
*/
public function is_content_filter() : bool
{
}
/**
* Get order
*
* @return string
*/
public function get_order()
{
}
/**
* Get url
*
* @param string $dir
*
* @return string
*/
public function get_url($dir)
{
}
/**
* Returns slug for a post type
*
* @todo This method is not used anywhere in the codebase. Should it be removed?
*
* @param string $post_type
*
* @return string
*/
public function get_slug(string $post_type) : string
{
}
/**
* @param string $language
*
* @return string
*/
public function get_icon($language)
{
}
/**
* Get flag url
*
* @param string $language
*
* @return string
*/
public function get_flag_url($language)
{
}
/**
* Get all available languages
*
* @return array<string, string>
*/
public function get_available_languages() : array
{
}
/**
* The 'blog'-slug-problem :/
*
* @param string $url
* @param MslsOptions $options
*
* @return string
*/
public static function check_for_blog_slug($url, $options)
{
}
/**
* Get the icon type by the settings saved in admin_display
*
* @return string
*/
public function get_icon_type() : string
{
}
}
/**
* MslsOptionsQuery
*
* @package Msls
*/
class MslsOptionsQuery extends \lloc\Msls\MslsOptions
{
/**
* Rewrite with front
*
* @var bool
*/
public ?bool $with_front = true;
protected \lloc\Msls\MslsSqlCacher $sql_cache;
public function __construct(\lloc\Msls\MslsSqlCacher $sql_cache)
{
}
/**
* @return array<string, mixed>
*/
public static function get_params() : array
{
}
/**
* Factory method
*
* @param int $id This parameter is unused here
*
* @return ?MslsOptionsQuery
*/
public static function create($id = 0) : ?\lloc\Msls\MslsOptionsQuery
{
}
/**
* Get postlink
*
* @param string $language
*
* @return string
*/
public function get_postlink($language)
{
}
}
}
namespace lloc\Msls\ContentImport {
/**
* Class Relations
*
* Manages and tracks the relations between elements managed by MSLS that are created in the context of an import.
*
* @package lloc\Msls\ContentImport
*/
class Relations
{
public array $to_create = array();
protected array $local_options = array();
/**
* @var ImportCoordinates
*/
protected $import_coordinates;
/**
* Relations constructor.
*
* @param ImportCoordinates $import_coordinates
*/
public function __construct(\lloc\Msls\ContentImport\ImportCoordinates $import_coordinates)
{
}
/**
* Merges the data from a Relations object into this one.
*
* @param Relations|null $relations
*/
public function merge(\lloc\Msls\ContentImport\Relations $relations = null) : void
{
}
/**
* @return array
*/
public function get_data() : array
{
}
/**
* Creates the relations between the source blog elements and the destination one.
*/
public function create() : void
{
}
protected function create_source_to_local() : void
{
}
protected function create_local_to_source() : void
{
}
/**
* Sets a relation that should be created.
*
* @param MslsOptions $creator
* @param string $dest_lang
* @param string $dest_post_id
*/
public function should_create(\lloc\Msls\MslsOptions $creator, $dest_lang, $dest_post_id) : void
{
}
}
class ImportCoordinates
{
const IMPORTERS_GLOBAL_KEY = 'msls_importers';
/**
* @var int
*/
public $source_blog_id;
/**
* @var int
*/
public $source_post_id;
/**
* @var int
*/
public $dest_blog_id;
/**
* @var int
*/
public $dest_post_id;
/**
* @var \WP_Post
*/
public $source_post;
/**
* @var string
*/
public $source_lang;
/**
* @var string
*/
public $dest_lang;
/**
* @var array An array keeping track of which importer (slug) should be used for
* a specific import type, shape [ <import-type> => <slug> ]
*/
public $importers = array();
/**
* Validates the coordinates.
*
* @return bool
*/
public function validate()
{
}
/**
* Returns the importer (slug) for a specific type of imports.
*
* @param string $importer_type
*
* @return string|null The import slug if set or `null` if not set.
*/
public function get_importer_for($importer_type)
{
}
/**
* Parses the importers from request superglobals.
*/
public function parse_importers_from_request() : void
{
}
/**
* Sets the slug of the importer that should be used for a type of import.
*
* @param string $importer_type
* @param string $slug
*/
public function set_importer_for($importer_type, $slug) : void
{
}
}
class MetaBox extends \lloc\Msls\MslsRegistryInstance
{
protected array $data = array();
/**
* Renders the content import metabox.
*/
public function render() : void
{
}
protected function inline_thickbox_url(array $data = array()) : string
{
}
public function print_modal_html() : void
{
}
protected function inline_thickbox_html($echo = true, array $data = array()) : string
{
}
}
}
namespace lloc\Msls\ContentImport\LogWriters {
interface LogWriter
{
/**
* Writes the log to the destination.
*
* @param array $data An array of data to log.
*
* @return mixed
*/
public function write(array $data);
}
class AdminNoticeLogger extends \lloc\Msls\MslsRegistryInstance implements \lloc\Msls\ContentImport\LogWriters\LogWriter
{
protected string $transient = 'msls_last_import_log';
/**
* @var ImportCoordinates
*/
protected $import_coordinates;
public function write(array $data)
{
}
/**
* @param string $section_title
* @param array $entries
* @param bool $escape_entries
*
* @return string
*/
protected function get_section_html($section_title, $entries, $escape_entries = true) : string
{
}
/**
* Shows the last log that was written.
*
* @param bool $echo
*
* @return ?string
*/
public function show_last_log($echo = true) : ?string
{
}
/**
* @param ImportCoordinates $import_coordinates
*/
public function set_import_coordinates($import_coordinates) : void
{
}
/**
* Returns the name of the transient where the logger will store the output HTML.
*
* @return string
*/
public function get_transient() : string
{
}
}
}
namespace lloc\Msls\ContentImport\Importers {
interface Importer
{
/**
* @param array $data
*
* @return array
*/
public function import(array $data);
/**
* @param ImportCoordinates $import_coordinates
*
* @return mixed
*/
public function set_import_coordinates(\lloc\Msls\ContentImport\ImportCoordinates $import_coordinates);
/**
* @return ImportLogger
*/
public function get_logger();
/**
* @return Relations
*/
public function get_relations();
/**
* Returns an array of information about the importer.
*
* @return \stdClass
*/
public static function info();
}
class BaseImporter implements \lloc\Msls\ContentImport\Importers\Importer
{
/**
* @var ImportCoordinates
*/
public $import_coordinates;
/**
* @var ImportLogger
*/
public $logger;
/**
* @var Relations
*/
public $relations;
/**
* BaseImporter constructor.
*
* @param ImportLogger|null $logger
* @param Relations|null $relations
*/
public function __construct(\lloc\Msls\ContentImport\ImportCoordinates $import_coordinates, \lloc\Msls\ContentImport\ImportLogger $logger = null, \lloc\Msls\ContentImport\Relations $relations = null)
{
}
/**
* @param array $data
*
* @return array
*/
public function import(array $data)
{
}
/**
* @param ImportCoordinates $import_coordinates
*
* @return mixed
*/
public function set_import_coordinates(\lloc\Msls\ContentImport\ImportCoordinates $import_coordinates)
{
}
/**
* @return ImportLogger
*/
public function get_logger()
{
}
/**
* @return Relations
*/
public function get_relations()
{
}
/**
* Returns an array of information about the importer.
*
* @return \stdClass
*/
public static function info()
{
}
}
}
namespace lloc\Msls\ContentImport\Importers\PostMeta {
class Duplicating extends \lloc\Msls\ContentImport\Importers\BaseImporter
{
const TYPE = 'duplicating';
/**
* Returns an array of information about the importer.
*
* @return \stdClass
*/
public static function info()
{
}
public function import(array $data)
{
}
/**
* Filters the post meta that should not be imported.
*
* @param array $meta
*
* @return array
*/
public function filter_post_meta(array $meta)
{
}
}
}
namespace lloc\Msls\ContentImport\Importers\PostThumbnail {
/**
* Class Linking
*
* Creates an attachment post for the post thumbnail in the destination blog without duplicating the attachment files.
*
* @package lloc\Msls\ContentImport\Importers\PostThumbnail
*/
class Linking extends \lloc\Msls\ContentImport\Importers\BaseImporter
{
const TYPE = 'linking';
/**
* Returns an array of information about the importer.
*
* @return \stdClass
*/
public static function info()
{
}
public function import(array $data)
{
}
/**
* @param int $source_post_thumbnail_id
*
* @return array
*/
protected function get_attachment_meta($source_post_thumbnail_id)
{
}
}
}
namespace lloc\Msls\ContentImport\Importers {
interface ImportersFactory
{
/**
* Builds the Importer that should be used depending on the import coordinates.
*
* @param \lloc\Msls\ContentImport\ImportCoordinates $import_coordinates
*
* @return Importer
*/
public function make(\lloc\Msls\ContentImport\ImportCoordinates $import_coordinates);
/**
* Returns the factory details.
*
* @return \stdClass
*/
public function details();
/**
* Returns the slug of the default importer for this factory.
*
* @return string
*/
public function selected();
}
abstract class ImportersBaseFactory extends \lloc\Msls\MslsRegistryInstance implements \lloc\Msls\ContentImport\Importers\ImportersFactory
{
/**
* The type of this importers factory; should be overridden by child classes.
*/
const TYPE = 'none';
/**
* @var array<string, string> An array defining the slug and Importer class relationships in
* the shape [ <slug> => <importer-class> ]
*/
protected array $importers_map = array();
/**
* @return Importer
*/
public function make(\lloc\Msls\ContentImport\ImportCoordinates $import_coordinates)
{
}
/**
* Returns the factory details.
*
* @return \stdClass
*/