="message collapsing has-emoji"> d01d7cf85d first commit лет назад: 4 https-migration.php d01d7cf85d first commit лет назад: 4 kses.php d01d7cf85d first commit лет назад: 4 l10n.php d01d7cf85d first commit лет назад: 4 link-template.php d01d7cf85d first commit лет назад: 4 load.php d01d7cf85d first commit лет назад: 4 locale.php d01d7cf85d first commit лет назад: 4 media-template.php d01d7cf85d first commit лет назад: 4 media.php d01d7cf85d first commit лет назад: 4 meta.php d01d7cf85d first commit лет назад: 4 ms-blogs.php d01d7cf85d first commit лет назад: 4 ms-default-constants.php d01d7cf85d first commit лет назад: 4 ms-default-filters.php d01d7cf85d first commit лет назад: 4 ms-deprecated.php d01d7cf85d first commit лет назад: 4 ms-files.php d01d7cf85d first commit лет назад: 4 ms-functions.php d01d7cf85d first commit лет назад: 4 ms-load.php d01d7cf85d first commit лет назад: 4 ms-network.php d01d7cf85d first commit лет назад: 4 ms-settings.php d01d7cf85d first commit лет назад: 4 ms-site.php d01d7cf85d first commit лет назад: 4 nav-menu-template.php d01d7cf85d first commit лет назад: 4 nav-menu.php d01d7cf85d first commit лет назад: 4 option.php d01d7cf85d first commit лет назад: 4 pluggable-deprecated.php d01d7cf85d first commit лет назад: 4 pluggable.php d01d7cf85d first commit лет назад: 4 plugin.php d01d7cf85d first commit лет назад: 4 post-formats.php d01d7cf85d first commit лет назад: 4 post-template.php d01d7cf85d first commit лет назад: 4 post-thumbnail-template.php d01d7cf85d first commit лет назад: 4 post.php d01d7cf85d first commit лет назад: 4 query.php d01d7cf85d first commit лет назад: 4 registration-functions.php d01d7cf85d first commit лет назад: 4 registration.php d01d7cf85d first commit лет назад: 4 rest-api.php d01d7cf85d first commit лет назад: 4 revision.php d01d7cf85d first commit лет назад: 4 rewrite.php d01d7cf85d first commit лет назад: 4 robots-template.php d01d7cf85d first commit лет назад: 4 rss-functions.php d01d7cf85d first commit лет назад: 4 rss.php d01d7cf85d first commit лет назад: 4 script-loader.php d01d7cf85d first commit лет назад: 4 session.php d01d7cf85d first commit лет назад: 4 shortcodes.php d01d7cf85d first commit лет назад: 4 sitemaps.php d01d7cf85d first commit лет назад: 4 spl-autoload-compat.php d01d7cf85d first commit лет назад: 4 taxonomy.php d01d7cf85d first commit лет назад: 4 template-canvas.php d01d7cf85d first commit лет назад: 4 template-loader.php d01d7cf85d first commit лет назад: 4 template.php d01d7cf85d first commit лет назад: 4 theme-i18n.json d01d7cf85d first commit лет назад: 4 theme-templates.php d01d7cf85d first commit лет назад: 4 theme.json d01d7cf85d first commit лет назад: 4 theme.php d01d7cf85d first commit лет назад: 4 update.php d01d7cf85d first commit лет назад: 4 user.php d01d7cf85d first commit лет назад: 4 vars.php d01d7cf85d first commit лет назад: 4 version.php d01d7cf85d first commit лет назад: 4 widgets.php d01d7cf85d first commit лет назад: 4 wlwmanifest.xml d01d7cf85d first commit лет назад: 4 wp-db.php d01d7cf85d first commit лет назад: 4 wp-diff.php d01d7cf85d first commit лет назад: 4 tum/whitesports - Gogs: Simplico Git Service

Nenhuma Descrição

class-wp-customize-code-editor-control.php 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /**
  3. * Customize API: WP_Customize_Code_Editor_Control class
  4. *
  5. * @package WordPress
  6. * @subpackage Customize
  7. * @since 4.9.0
  8. */
  9. /**
  10. * Customize Code Editor Control class.
  11. *
  12. * @since 4.9.0
  13. *
  14. * @see WP_Customize_Control
  15. */
  16. class WP_Customize_Code_Editor_Control extends WP_Customize_Control {
  17. /**
  18. * Customize control type.
  19. *
  20. * @since 4.9.0
  21. * @var string
  22. */
  23. public $type = 'code_editor';
  24. /**
  25. * Type of code that is being edited.
  26. *
  27. * @since 4.9.0
  28. * @var string
  29. */
  30. public $code_type = '';
  31. /**
  32. * Code editor settings.
  33. *
  34. * @see wp_enqueue_code_editor()
  35. * @since 4.9.0
  36. * @var array|false
  37. */
  38. public $editor_settings = array();
  39. /**
  40. * Enqueue control related scripts/styles.
  41. *
  42. * @since 4.9.0
  43. */
  44. public function enqueue() {
  45. $this->editor_settings = wp_enqueue_code_editor(
  46. array_merge(
  47. array(
  48. 'type' => $this->code_type,
  49. 'codemirror' => array(
  50. 'indentUnit' => 2,
  51. 'tabSize' => 2,
  52. ),
  53. ),
  54. $this->editor_settings
  55. )
  56. );
  57. }
  58. /**
  59. * Refresh the parameters passed to the JavaScript via JSON.
  60. *
  61. * @since 4.9.0
  62. *
  63. * @see WP_Customize_Control::json()
  64. *
  65. * @return array Array of parameters passed to the JavaScript.
  66. */
  67. public function json() {
  68. $json = parent::json();
  69. $json['editor_settings'] = $this->editor_settings;
  70. $json['input_attrs'] = $this->input_attrs;
  71. return $json;
  72. }
  73. /**
  74. * Don't render the control content from PHP, as it's rendered via JS on load.
  75. *
  76. * @since 4.9.0
  77. */
  78. public function render_content() {}
  79. /**
  80. * Render a JS template for control display.
  81. *
  82. * @since 4.9.0
  83. */
  84. public function content_template() {
  85. ?>
  86. <# var elementIdPrefix = 'el' + String( Math.random() ); #>
  87. <# if ( data.label ) { #>
  88. <label for="{{ elementIdPrefix }}_editor" class="customize-control-title">
  89. {{ data.label }}
  90. </label>
  91. <# } #>
  92. <# if ( data.description ) { #>
  93. <span class="description customize-control-description">{{{ data.description }}}</span>
  94. <# } #>
  95. <div class="customize-control-notifications-container"></div>
  96. <textarea id="{{ elementIdPrefix }}_editor"
  97. <# _.each( _.extend( { 'class': 'code' }, data.input_attrs ), function( value, key ) { #>
  98. {{{ key }}}="{{ value }}"
  99. <# }); #>
  100. ></textarea>
  101. <?php
  102. }
  103. }