From 26c69b1c73bebd596c480d68686793e17d3f3dcb Mon Sep 17 00:00:00 2001 From: Takayuki Miyoshi Date: Wed, 28 Aug 2024 13:40:16 +0900 Subject: [PATCH] Add inline documents #1464 #525 --- admin/includes/tag-generator.php | 71 ++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/admin/includes/tag-generator.php b/admin/includes/tag-generator.php index 92b07d7a..c433de04 100644 --- a/admin/includes/tag-generator.php +++ b/admin/includes/tag-generator.php @@ -1,5 +1,8 @@ '; @@ -75,6 +90,10 @@ public function print_buttons() { echo ''; } + + /** + * Renders form-tag generator dialog panels (hidden until called). + */ public function print_panels( WPCF7_ContactForm $contact_form ) { foreach ( (array) $this->panels as $id => $panel ) { $callback = $panel['callback']; @@ -120,14 +139,25 @@ public function print_panels( WPCF7_ContactForm $contact_form ) { } +/** + * Class helps to implement a form-tag generator content. + */ class WPCF7_TagGeneratorGenerator { private $key = ''; + + /** + * The constructor. + */ public function __construct( $key ) { $this->key = $key; } + + /** + * Returns a unique reference ID. + */ public function ref( $suffix = '' ) { $ref = sprintf( '%s-%s', $this->key, $suffix ); $ref = strtolower( $ref ); @@ -137,12 +167,20 @@ public function ref( $suffix = '' ) { return $ref; } + + /** + * Calls one of the template methods. + */ public function print( $part, $options = '' ) { if ( is_callable( array( $this, $part ) ) ) { call_user_func( array( $this, $part ), $options ); } } + + /** + * Template method for field type field. + */ private function field_type( $options = '' ) { $options = wp_parse_args( $options, array( 'with_required' => false, @@ -178,6 +216,10 @@ private function field_type( $options = '' ) { '', @@ -236,6 +278,10 @@ private function field_name( $options = '' ) {
@@ -247,6 +293,10 @@ private function id_attr( $options = '' ) {
@@ -258,6 +308,10 @@ private function class_attr( $options = '' ) { 'number', @@ -303,6 +357,10 @@ private function min_max( $options = '' ) { 'text', @@ -338,6 +396,10 @@ private function default_value( $options = '' ) { false, @@ -408,6 +470,10 @@ private function selectable_values( $options = '' ) {
@@ -429,6 +495,10 @@ private function insert_box_content( $options = '' ) {