-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Classic Theme Helper: Copy Testimonials Custom Post Type code to Clas…
…sic Theme Helper package (#40295) Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12034410054 Upstream-Ref: Automattic/jetpack@63a223a
- Loading branch information
1 parent
d0fdc5c
commit a82b7a3
Showing
11 changed files
with
1,050 additions
and
89 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...classic-theme-helper/src/custom-post-types/class-jetpack-testimonial-textarea-control.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* Helper class for the Jetpack Testimonial Textarea Control. | ||
* | ||
* @package automattic/jetpack-classic-theme-helper | ||
*/ | ||
|
||
namespace Automattic\Jetpack\Classic_Theme_Helper; | ||
|
||
if ( ! class_exists( __NAMESPACE__ . '\Jetpack_Testimonial_Textarea_Control' ) ) { | ||
/** | ||
* Extends the WP_Customize_Control class to clean the textarea content. | ||
*/ | ||
class Jetpack_Testimonial_Textarea_Control extends \WP_Customize_Control { | ||
/** | ||
* Control type. | ||
* | ||
* @var string | ||
*/ | ||
public $type = 'textarea'; | ||
|
||
/** | ||
* Render the control's content. | ||
*/ | ||
public function render_content() { | ||
?> | ||
<label> | ||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> | ||
<textarea rows="5" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea> | ||
</label> | ||
<?php | ||
} | ||
|
||
/** | ||
* Sanitize content passed to control. | ||
* | ||
* @param string $value Control value. | ||
* @return string Sanitized value. | ||
*/ | ||
public static function sanitize_content( $value ) { | ||
if ( ! empty( $value ) ) { | ||
$value = apply_filters( 'the_content', $value ); | ||
} | ||
$value = preg_replace( '@<div id="jp-post-flair"([^>]+)?>(.+)?</div>@is', '', $value ); | ||
return $value; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...ck-classic-theme-helper/src/custom-post-types/class-jetpack-testimonial-title-control.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* Helper class for the Jetpack Testimonial Title Control. | ||
* | ||
* @package automattic/jetpack-classic-theme-helper | ||
*/ | ||
|
||
namespace Automattic\Jetpack\Classic_Theme_Helper; | ||
|
||
if ( ! class_exists( __NAMESPACE__ . '\Jetpack_Testimonial_Title_Control' ) ) { | ||
/** | ||
* Extends the WP_Customize_Control class to clean the title parameter. | ||
*/ | ||
class Jetpack_Testimonial_Title_Control extends \WP_Customize_Control { | ||
/** | ||
* Sanitize content passed to control. | ||
* | ||
* @param string $value Control value. | ||
* @return string Sanitized value. | ||
*/ | ||
public static function sanitize_content( $value ) { | ||
if ( '' != $value ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseNotEqual -- handle non-string inputs gracefully. | ||
$value = trim( convert_chars( wptexturize( $value ) ) ); | ||
} | ||
return $value; | ||
} | ||
} | ||
} |
Oops, something went wrong.