PluginProbe
My WP Customize Admin/Frontend / 1.8
My WP Customize Admin/Frontend v1.8
1.27.4 1.27.3 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.10 1.10.1 1.10.2 1.11 1.12 1.12.1 1.12.2 1.13 1.13.1 1.13.2 1.14 1.15.0 1.16 1.17.0 All 76 releases
my-wp / controller / modules / mywp.controller.module.admin.post.edit.php

mywp.controller.module.admin.post.edit.php in My WP Customize Admin/Frontend 1.8, at controller/modules/mywp.controller.module.admin.post.edit.php

999 lines 20.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 if( ! class_exists( 'MywpControllerAbstractModule' ) ) {
8 return false;
9 }
10
11 if ( ! class_exists( 'MywpControllerModuleAdminPostEdit' ) ) :
12
13 final class MywpControllerModuleAdminPostEdit extends MywpControllerAbstractModule {
14
15 static protected $id = 'admin_post_edit';
16
17 static private $post_type = '';
18
19 public static function mywp_controller_initial_data( $initial_data ) {
20
21 $initial_data['block_editor_meta_boxes'] = array();
22
23 $initial_data['meta_boxes'] = array();
24
25 $initial_data['use_classic_editor'] = '';
26
27 $initial_data['post_updated_messages'] = array();
28
29 $initial_data['hide_add_new'] = '';
30 $initial_data['hide_title'] = '';
31 $initial_data['change_title_placeholder'] = '';
32 $initial_data['auto_change_title'] = '';
33 $initial_data['hide_permalink'] = '';
34 $initial_data['hide_change_permalink'] = '';
35 $initial_data['hide_content'] = '';
36 $initial_data['prevent_meta_box'] = '';
37 $initial_data['forced_editor'] = '';
38
39 $initial_data['hide_publish_metabox_draft'] = '';
40 $initial_data['hide_publish_metabox_preview'] = '';
41 $initial_data['hide_publish_metabox_change_post_status'] = '';
42 $initial_data['hide_publish_metabox_change_publish_status'] = '';
43 $initial_data['hide_publish_metabox_change_publish_on'] = '';
44
45 return $initial_data;
46
47 }
48
49 public static function mywp_controller_default_data( $default_data ) {
50
51 $initial_data['block_editor_meta_boxes'] = array();
52
53 $default_data['meta_boxes'] = array();
54
55 $default_data['use_classic_editor'] = false;
56
57 $default_data['post_updated_messages'] = array();
58
59 $default_data['hide_add_new'] = false;
60 $default_data['hide_title'] = false;
61 $default_data['change_title_placeholder'] = '';
62 $default_data['auto_change_title'] = false;
63 $default_data['hide_permalink'] = false;
64 $default_data['hide_change_permalink'] = false;
65 $default_data['hide_content'] = false;
66 $default_data['prevent_meta_box'] = false;
67 $default_data['forced_editor'] = false;
68
69 $default_data['hide_publish_metabox_draft'] = false;
70 $default_data['hide_publish_metabox_preview'] = false;
71 $default_data['hide_publish_metabox_change_post_status'] = false;
72 $default_data['hide_publish_metabox_change_publish_status'] = false;
73 $default_data['hide_publish_metabox_change_publish_on'] = false;
74
75 return $default_data;
76
77 }
78
79 public static function get_update_messages_default() {
80
81 $update_messages_default = array(
82 1 => array(
83 'title' => __( 'Post updated' , 'my-wp' ),
84 'message' => __( 'Post updated.' ),
85 ),
86 2 => array(
87 'title' => __( 'Custom field updated' , 'my-wp' ),
88 'message' => __( 'Custom field updated.' ),
89 ),
90 3 => array(
91 'title' => __( 'Custom field deleted' , 'my-wp' ),
92 'message' => __( 'Custom field updated.' ),
93 ),
94 4 => array(
95 'title' => __( 'Post updated' , 'my-wp' ),
96 'message' => __( 'Post updated.' ),
97 ),
98 5 => array(
99 'title' => __( 'Revision' ),
100 'message' => sprintf( __( 'Post restored to revision from %s.' ), __( 'Post Title' ) ),
101 ),
102 6 => array(
103 'title' => __( 'Post published' , 'my-wp' ),
104 'message' => __( 'Post published.' ),
105 ),
106 7 => array(
107 'title' => __( 'Post saved' , 'my-wp' ),
108 'message' => __( 'Post saved.' ),
109 ),
110 8 => array(
111 'title' => __( 'Post submitted' , 'my-wp' ),
112 'message' => __( 'Post submitted.' ),
113 ),
114 9 => array(
115 'title' => __( 'Post Scheduled' , 'my-wp' ),
116 'message' => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . __( 'Schedule Date' , 'my-wp' ) . '</strong>' ) . __( 'Schedule Link' , 'my-wp' ),
117 ),
118 10 => array(
119 'title' => __( 'Post draft updated' , 'my-wp' ),
120 'message' => __( 'Post draft updated.' ) . __( 'Preview Post Link' ),
121 ),
122 );
123
124 return $update_messages_default;
125
126 }
127
128 public static function mywp_wp_loaded() {
129
130 if( ! is_admin() ) {
131
132 return false;
133
134 }
135
136 if( is_network_admin() ) {
137
138 return false;
139
140 }
141
142 if( ! self::is_do_controller() ) {
143
144 return false;
145
146 }
147
148 add_action( 'load-post.php' , array( __CLASS__ , 'load_post' ) , 1000 );
149 add_action( 'load-post-new.php' , array( __CLASS__ , 'load_post' ) , 1000 );
150
151 }
152
153 public static function mywp_model_get_option_key( $option_key ) {
154
155 if( empty( self::$post_type ) ) {
156
157 return $option_key;
158
159 }
160
161 $option_key .= '_' . self::$post_type;
162
163 return $option_key;
164
165 }
166
167 public static function load_post() {
168
169 global $typenow;
170
171 if( empty( $typenow ) ) {
172
173 return false;
174
175 }
176
177 self::$post_type = $typenow;
178
179 add_filter( 'mywp_model_get_option_key_mywp_' . self::$id , array( __CLASS__ , 'mywp_model_get_option_key' ) );
180
181 add_filter( 'post_updated_messages' , array( __CLASS__ , 'change_post_updated_messages' ) );
182
183 add_filter( 'use_block_editor_for_post_type' , array( __CLASS__ , 'chenge_editor' ) );
184
185 add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_add_new' ) );
186
187 add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_title' ) );
188
189 add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_permalink' ) );
190
191 add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_change_permalink' ) );
192
193 add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_content' ) );
194
195 add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_publish_metabox_draft' ) );
196
197 add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_publish_metabox_preview' ) );
198
199 add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_publish_metabox_change_post_status' ) );
200
201 add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_publish_metabox_change_publish_status' ) );
202
203 add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_publish_metabox_change_publish_on' ) );
204
205 add_action( 'admin_print_styles' , array( __CLASS__ , 'forced_editor_buttons' ) );
206
207 add_action( 'admin_head' , array( __CLASS__ , 'hide_meta_boxes' ) );
208
209 add_action( 'admin_head' , array( __CLASS__ , 'hide_block_editor_meta_boxes' ) );
210
211 add_action( 'in_admin_header' , array( __CLASS__ , 'remove_meta_boxes' ) );
212
213 add_action( 'in_admin_header' , array( __CLASS__ , 'change_title_meta_boxes' ) );
214
215 add_filter( 'wp_default_editor' , array( __CLASS__ , 'forced_editor' ) );
216
217 add_filter( 'enter_title_here' , array( __CLASS__ , 'change_title_placeholder' ) );
218
219 add_action( 'admin_print_footer_scripts' , array( __CLASS__ , 'prevent_meta_boxes' ) );
220
221 add_action( 'admin_print_footer_scripts' , array( __CLASS__ , 'auto_change_title' ) );
222
223 }
224
225 public static function change_post_updated_messages( $post_updated_messages ) {
226
227 if( ! self::is_do_function( __FUNCTION__ ) ) {
228
229 return $post_updated_messages;
230
231 }
232
233 $setting_data = self::get_setting_data();
234
235 if( empty( $setting_data['post_updated_messages'] ) ) {
236
237 return $post_updated_messages;
238
239 }
240
241 $post_updated_messages_default = self::get_update_messages_default();
242
243 foreach( $post_updated_messages_default as $key => $v ) {
244
245 if( ! empty( $setting_data['post_updated_messages'][ $key ] ) ) {
246
247 $post_updated_messages[ self::$post_type ][ $key ] = $setting_data['post_updated_messages'][ $key ];
248
249 }
250
251 }
252
253 self::after_do_function( __FUNCTION__ );
254
255 return $post_updated_messages;
256
257 }
258
259 public static function chenge_editor( $is_use_block_editor ) {
260
261 if( ! self::is_do_function( __FUNCTION__ ) ) {
262
263 return false;
264
265 }
266
267 if( empty( $is_use_block_editor ) ) {
268
269 return $is_use_block_editor;
270
271 }
272
273 $setting_data = self::get_setting_data();
274
275 if( empty( $setting_data['use_classic_editor'] ) ) {
276
277 return $is_use_block_editor;
278
279 }
280
281 $is_use_block_editor = false;
282
283 self::after_do_function( __FUNCTION__ );
284
285 return $is_use_block_editor;
286
287 }
288
289 public static function hide_add_new() {
290
291 if( ! self::is_do_function( __FUNCTION__ ) ) {
292
293 return false;
294
295 }
296
297 $setting_data = self::get_setting_data();
298
299 if( empty( $setting_data['hide_add_new'] ) ) {
300
301 return false;
302
303 }
304
305 echo '<style>';
306
307 echo '.wrap h1 > a { display: none; }';
308 echo '.wrap > a.page-title-action { display: none; }';
309
310 echo '</style>';
311
312 self::after_do_function( __FUNCTION__ );
313
314 }
315
316 public static function hide_title() {
317
318 if( ! self::is_do_function( __FUNCTION__ ) ) {
319
320 return false;
321
322 }
323
324 $setting_data = self::get_setting_data();
325
326 if( empty( $setting_data['hide_title'] ) ) {
327
328 return false;
329
330 }
331
332 echo '<style>';
333
334 echo '#post-body-content #titlewrap { display: none; }';
335
336 echo '</style>';
337
338 self::after_do_function( __FUNCTION__ );
339
340 }
341
342 public static function hide_permalink() {
343
344 if( ! self::is_do_function( __FUNCTION__ ) ) {
345
346 return false;
347
348 }
349
350 $setting_data = self::get_setting_data();
351
352 if( empty( $setting_data['hide_permalink'] ) ) {
353
354 return false;
355
356 }
357
358 echo '<style>';
359
360 echo '#post-body-content #titlediv .inside { display: none; }';
361
362 echo '</style>';
363
364 self::after_do_function( __FUNCTION__ );
365
366 }
367
368 public static function hide_change_permalink() {
369
370 if( ! self::is_do_function( __FUNCTION__ ) ) {
371
372 return false;
373
374 }
375
376 $setting_data = self::get_setting_data();
377
378 if( empty( $setting_data['hide_change_permalink'] ) ) {
379
380 return false;
381
382 }
383
384 echo '<style>';
385
386 echo '#post-body-content #change-permalinks { display: none; }';
387
388 echo '</style>';
389
390 self::after_do_function( __FUNCTION__ );
391
392 }
393
394 public static function hide_content() {
395
396 if( ! self::is_do_function( __FUNCTION__ ) ) {
397
398 return false;
399
400 }
401
402 $setting_data = self::get_setting_data();
403
404 if( empty( $setting_data['hide_content'] ) ) {
405
406 return false;
407
408 }
409
410 echo '<style>';
411
412 echo '#post-body-content #postdivrich { display: none; }';
413
414 echo '</style>';
415
416 self::after_do_function( __FUNCTION__ );
417
418 }
419
420 public static function hide_publish_metabox_draft() {
421
422 if( ! self::is_do_function( __FUNCTION__ ) ) {
423
424 return false;
425
426 }
427
428 $setting_data = self::get_setting_data();
429
430 if( empty( $setting_data['hide_publish_metabox_draft'] ) ) {
431
432 return false;
433
434 }
435
436 echo '<style>';
437
438 echo '#minor-publishing-actions #save-action { display: none; }';
439
440 echo '</style>';
441
442 self::after_do_function( __FUNCTION__ );
443
444 }
445
446 public static function hide_publish_metabox_preview() {
447
448 if( ! self::is_do_function( __FUNCTION__ ) ) {
449
450 return false;
451
452 }
453
454 $setting_data = self::get_setting_data();
455
456 if( empty( $setting_data['hide_publish_metabox_preview'] ) ) {
457
458 return false;
459
460 }
461
462 echo '<style>';
463
464 echo '#minor-publishing-actions #preview-action { display: none; }';
465
466 echo '</style>';
467
468 self::after_do_function( __FUNCTION__ );
469
470 }
471
472 public static function hide_publish_metabox_change_post_status() {
473
474 if( ! self::is_do_function( __FUNCTION__ ) ) {
475
476 return false;
477
478 }
479
480 $setting_data = self::get_setting_data();
481
482 if( empty( $setting_data['hide_publish_metabox_change_post_status'] ) ) {
483
484 return false;
485
486 }
487
488 echo '<style>';
489
490 echo '#misc-publishing-actions .misc-pub-section.misc-pub-post-status { display: none; }';
491
492 echo '</style>';
493
494 self::after_do_function( __FUNCTION__ );
495
496 }
497
498 public static function hide_publish_metabox_change_publish_status() {
499
500 if( ! self::is_do_function( __FUNCTION__ ) ) {
501
502 return false;
503
504 }
505
506 $setting_data = self::get_setting_data();
507
508 if( empty( $setting_data['hide_publish_metabox_change_publish_status'] ) ) {
509
510 return false;
511
512 }
513
514 echo '<style>';
515
516 echo '#misc-publishing-actions .misc-pub-section.misc-pub-visibility { display: none; }';
517
518 echo '</style>';
519
520 self::after_do_function( __FUNCTION__ );
521
522 }
523
524 public static function hide_publish_metabox_change_publish_on() {
525
526 if( ! self::is_do_function( __FUNCTION__ ) ) {
527
528 return false;
529
530 }
531
532 $setting_data = self::get_setting_data();
533
534 if( empty( $setting_data['hide_publish_metabox_change_publish_on'] ) ) {
535
536 return false;
537
538 }
539
540 echo '<style>';
541
542 echo '#misc-publishing-actions .misc-pub-section.misc-pub-curtime { display: none; }';
543
544 echo '</style>';
545
546 self::after_do_function( __FUNCTION__ );
547
548 }
549
550 public static function forced_editor_buttons() {
551
552 if( ! self::is_do_function( __FUNCTION__ ) ) {
553
554 return false;
555
556 }
557
558 $setting_data = self::get_setting_data();
559
560 if( empty( $setting_data['forced_editor'] ) ) {
561
562 return false;
563
564 }
565
566 echo '<style>';
567
568 echo '#wp-content-editor-tools .wp-editor-tabs { display: none; }';
569
570 echo '</style>';
571
572 self::after_do_function( __FUNCTION__ );
573
574 }
575
576 public static function hide_meta_boxes() {
577
578 if( ! self::is_do_function( __FUNCTION__ ) ) {
579
580 return false;
581
582 }
583
584 $setting_data = self::get_setting_data();
585
586 if( empty( $setting_data['meta_boxes'] ) ) {
587
588 return false;
589
590 }
591
592 $hide_meta_boxes = array();
593
594 foreach( $setting_data['meta_boxes'] as $meta_box_id => $meta_box_setting ) {
595
596 if( $meta_box_setting['action'] !== 'hide' ) {
597
598 continue;
599
600 }
601
602 $hide_meta_boxes[] = $meta_box_id;
603
604 }
605
606 if( empty( $hide_meta_boxes ) ) {
607
608 return false;
609
610 }
611
612 echo '<style>';
613
614 foreach( $hide_meta_boxes as $meta_box_id ) {
615
616 printf( '.postbox#%s { height: 0; overflow: hidden; margin: 0; box-shadow: none; border: 0 none; }' , $meta_box_id );
617
618 }
619
620 echo '</style>';
621
622 echo '<script>jQuery(document).ready(function($){';
623
624 foreach( $hide_meta_boxes as $meta_box_id ) {
625
626 printf( '$("#screen-options-wrap .metabox-prefs label[for=%s-hide]").css("display", "none");' , $meta_box_id );
627
628 }
629
630 echo '});</script>';
631
632 self::after_do_function( __FUNCTION__ );
633
634 }
635
636 public static function hide_block_editor_meta_boxes() {
637
638 if( ! self::is_do_function( __FUNCTION__ ) ) {
639
640 return false;
641
642 }
643
644 $setting_data = self::get_setting_data();
645
646 if( empty( $setting_data['block_editor_meta_boxes'] ) ) {
647
648 return false;
649
650 }
651
652 $current_meta_boxes = MywpSettingMetaBox::get_block_editor_meta_boxes();
653
654 if( empty( $current_meta_boxes ) ) {
655
656 return false;
657
658 }
659
660 $hide_meta_boxes_num = array();
661
662 foreach( $setting_data['block_editor_meta_boxes'] as $block_editor_meta_box_id => $block_editor_meta_box_setting ) {
663
664 if( $block_editor_meta_box_setting['action'] !== 'hide' ) {
665
666 continue;
667
668 }
669
670 if( empty( $current_meta_boxes[ $block_editor_meta_box_id ]['num'] ) ) {
671
672 continue;
673
674 }
675
676 $hide_meta_boxes_num[] = $current_meta_boxes[ $block_editor_meta_box_id ]['num'];
677
678 }
679
680 if( empty( $hide_meta_boxes_num ) ) {
681
682 return false;
683
684 }
685
686 echo '<style>';
687
688 foreach( $hide_meta_boxes_num as $hide_meta_boxes_num ) {
689
690 printf( '.components-panel .components-panel__body:nth-child(%d) { display: none; }' , $hide_meta_boxes_num );
691
692 }
693
694 echo '</style>';
695
696 self::after_do_function( __FUNCTION__ );
697
698 }
699
700 public static function remove_meta_boxes() {
701
702 global $wp_meta_boxes;
703
704 if( ! self::is_do_function( __FUNCTION__ ) ) {
705
706 return false;
707
708 }
709
710 $setting_data = self::get_setting_data();
711
712 if( empty( $setting_data['meta_boxes'] ) ) {
713
714 return false;
715
716 }
717
718 $remove_meta_boxes = array();
719
720 foreach( $setting_data['meta_boxes'] as $meta_box_id => $meta_box_setting ) {
721
722 if( $meta_box_setting['action'] != 'remove' ) {
723
724 continue;
725
726 }
727
728 $remove_meta_boxes[] = $meta_box_id;
729
730 }
731
732 if( empty( $remove_meta_boxes ) ) {
733
734 return false;
735
736 }
737
738 if( empty( $wp_meta_boxes[ self::$post_type ] ) ) {
739
740 return false;
741
742 }
743
744 $current_meta_boxes = $wp_meta_boxes[ self::$post_type ];
745
746 foreach( $current_meta_boxes as $context => $priority_meta_boxes ) {
747
748 if( empty( $priority_meta_boxes ) or ! is_array( $priority_meta_boxes ) ) {
749
750 continue;
751
752 }
753
754 foreach( $priority_meta_boxes as $priority => $meta_boxes ) {
755
756 if( empty( $meta_boxes ) or ! is_array( $meta_boxes ) ) {
757
758 continue;
759
760 }
761
762 foreach( $meta_boxes as $meta_box_id => $meta_box ) {
763
764 if( empty( $meta_box ) or ! is_array( $meta_box ) ) {
765
766 continue;
767
768 }
769
770 if( ! in_array( $meta_box_id , $remove_meta_boxes ) ) {
771
772 continue;
773
774 }
775
776 remove_meta_box( $meta_box_id , self::$post_type , $context );
777
778 }
779
780 }
781
782 }
783
784 self::after_do_function( __FUNCTION__ );
785
786 }
787
788 public static function change_title_meta_boxes() {
789
790 global $wp_meta_boxes;
791
792 if( ! self::is_do_function( __FUNCTION__ ) ) {
793
794 return false;
795
796 }
797
798 $setting_data = self::get_setting_data();
799
800 if( empty( $setting_data['meta_boxes'] ) ) {
801
802 return false;
803
804 }
805
806 $change_title_meta_boxes = array();
807
808 foreach( $setting_data['meta_boxes'] as $meta_box_id => $meta_box_setting ) {
809
810 if( ! empty( $meta_box_setting['action'] ) ) {
811
812 continue;
813
814 }
815
816 if( empty( $meta_box_setting['title'] ) ) {
817
818 continue;
819
820 }
821
822 $change_title_meta_boxes[ $meta_box_id ] = $meta_box_setting['title'];
823
824 }
825
826 if( empty( $change_title_meta_boxes ) ) {
827
828 return false;
829
830 }
831
832 if( empty( $wp_meta_boxes[ self::$post_type ] ) ) {
833
834 return false;
835
836 }
837
838 $current_meta_boxes = $wp_meta_boxes[ self::$post_type ];
839
840 foreach( $current_meta_boxes as $context => $priority_meta_boxes ) {
841
842 if( empty( $priority_meta_boxes ) or ! is_array( $priority_meta_boxes ) ) {
843
844 continue;
845
846 }
847
848 foreach( $priority_meta_boxes as $priority => $meta_boxes ) {
849
850 if( empty( $meta_boxes ) or ! is_array( $meta_boxes ) ) {
851
852 continue;
853
854 }
855
856 foreach( $meta_boxes as $meta_box_id => $meta_box ) {
857
858 if( empty( $meta_box ) or ! is_array( $meta_box ) ) {
859
860 continue;
861
862 }
863
864 if( empty( $change_title_meta_boxes[ $meta_box_id ] ) ) {
865
866 continue;
867
868 }
869
870 $wp_meta_boxes[ self::$post_type ][ $context ][ $priority ][ $meta_box_id ]['title'] = do_shortcode( $change_title_meta_boxes[ $meta_box_id ] );
871
872 }
873
874 }
875
876 }
877
878 self::after_do_function( __FUNCTION__ );
879
880 }
881
882 public static function forced_editor( $wp_default_editor ) {
883
884 if( ! self::is_do_function( __FUNCTION__ ) ) {
885
886 return $wp_default_editor;
887
888 }
889
890 $setting_data = self::get_setting_data();
891
892 if( ! empty( $setting_data['forced_editor'] ) or in_array( $setting_data['forced_editor'] , array( 'text' , 'tinymce' ) ) ) {
893
894 $wp_default_editor = $setting_data['forced_editor'];
895
896 }
897
898 self::after_do_function( __FUNCTION__ );
899
900 return $wp_default_editor;
901
902 }
903
904 public static function change_title_placeholder( $title_placeholder ) {
905
906 if( ! self::is_do_function( __FUNCTION__ ) ) {
907
908 return $title_placeholder;
909
910 }
911
912 $setting_data = self::get_setting_data();
913
914 if( empty( $setting_data['change_title_placeholder'] ) ) {
915
916 return $title_placeholder;
917
918 }
919
920 $title_placeholder = $setting_data['change_title_placeholder'];
921
922 self::after_do_function( __FUNCTION__ );
923
924 return $title_placeholder;
925
926 }
927
928 public static function prevent_meta_boxes() {
929
930 if( ! self::is_do_function( __FUNCTION__ ) ) {
931
932 return false;
933
934 }
935
936 $setting_data = self::get_setting_data();
937
938 if( empty( $setting_data['prevent_meta_box'] ) ) {
939
940 return false;
941
942 }
943
944 echo '<script>jQuery(document).ready(function($){';
945
946 echo '$(".meta-box-sortables").sortable("disable");';
947
948 echo '});</script>';
949
950 echo '<style>';
951
952 echo '.js .postbox .hndle { cursor: pointer; }';
953
954 echo '</style>';
955
956 self::after_do_function( __FUNCTION__ );
957
958 }
959
960 public static function auto_change_title() {
961
962 global $post;
963
964 if( empty( $post ) or empty( $post->ID ) ) {
965
966 return false;
967
968 }
969
970 if( ! self::is_do_function( __FUNCTION__ ) ) {
971
972 return false;
973
974 }
975
976 $setting_data = self::get_setting_data();
977
978 if( empty( $setting_data['auto_change_title'] ) ) {
979
980 return false;
981
982 }
983
984 echo '<script>jQuery(document).ready(function($){';
985
986 echo '$("#titlediv #titlewrap #title").val( ' . $post->ID . ');';
987
988 echo '});</script>';
989
990 self::after_do_function( __FUNCTION__ );
991
992 }
993
994 }
995
996 MywpControllerModuleAdminPostEdit::init();
997
998 endif;
999