Initial commit.

This commit is contained in:
2025-11-24 21:33:55 +00:00
parent 14b7ade051
commit d6e9d316bc
8974 changed files with 1423277 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
/**
* Tab panel view
*
* @package Automattic\WooCommerce\Pinterest\View\PHPView
*/
declare( strict_types=1 );
use Automattic\WooCommerce\Pinterest\View\PHPView;
defined( 'ABSPATH' ) || exit;
/**
* PHP view.
*
* @var PHPView $this
*/
/**
* Form
*
* @var array $form
*/
$form = $this->form
?>
<div id="pinterest_attributes" class="panel woocommerce_options_panel">
<h2><?php esc_html_e( 'Product attributes', 'pinterest-for-woocommerce' ); ?></h2>
<p class="show_if_variable"><?php esc_html_e( 'As this is a variable product, you can add additional product attributes by going to Variations > Select one variation > Pinterest.', 'pinterest-for-woocommerce' ); ?></p>
<?php
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->render_partial( 'inputs/form', array( 'form' => $form ) );
?>
</div>

View File

@@ -0,0 +1,62 @@
<?php
/**
* Variation forms.
*
* @package Automattic\WooCommerce\Pinterest\View\PHPView
*/
declare( strict_types=1 );
use Automattic\WooCommerce\Pinterest\Admin\Input\SelectWithTextInput;
use Automattic\WooCommerce\Pinterest\View\PHPView;
defined( 'ABSPATH' ) || exit;
/**
* PHP view.
*
* @var PHPView $this
*/
/**
* Form children.
*
* @var array $children
*/
$children = $this->children;
?>
<?php if ( $this->is_root ) : ?>
<div class="pinterest-metabox wc-metabox closed">
<h3>
<strong><?php esc_html_e( 'Pinterest', 'pinterest-for-woocommerce' ); ?></strong>
<div class="handlediv" aria-label="Click to toggle"></div>
</h3>
<div class="wc-metabox-content" style="display: none;">
<?php endif; ?>
<?php
foreach ( $children as $form ) {
if ( ! empty( $form['type'] ) ) {
$form['wrapper_class'] =
sprintf( '%s %s', $form['wrapper_class'] ?? '', 'form-row form-row-full' );
if ( 'select-with-text-input' === $form['type'] && ! empty( $form['children'][ SelectWithTextInput::SELECT_INPUT_KEY ] ) && ! empty( $form['children'][ SelectWithTextInput::CUSTOM_INPUT_KEY ] ) ) {
$form['children'][ SelectWithTextInput::SELECT_INPUT_KEY ]['wrapper_class'] =
sprintf( '%s %s', $form['children'][ SelectWithTextInput::SELECT_INPUT_KEY ]['wrapper_class'] ?? '', 'form-row form-row-first' );
$form['children'][ SelectWithTextInput::CUSTOM_INPUT_KEY ]['wrapper_class'] =
sprintf( '%s %s', $form['children'][ SelectWithTextInput::CUSTOM_INPUT_KEY ]['wrapper_class'] ?? '', 'form-row form-row-last' );
}
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->render_partial( 'inputs/form', array( 'form' => $form ) );
} else {
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->render_partial( 'attributes/variations-form', $form );
}
}
?>
<?php if ( $this->is_root ) : ?>
</div>
</div>
<?php endif; ?>

View File

@@ -0,0 +1,42 @@
<?php
/**
* Form
*
* @package Automattic\WooCommerce\Pinterest\View\PHPView
*/
declare( strict_types=1 );
defined( 'ABSPATH' ) || exit;
/**
* PHP view.
*
* @var \Automattic\WooCommerce\Pinterest\View\PHPView $this
*/
/**
* Form.
*
* @var array $form
*/
$form = $this->form;
?>
<div class="pinterest-input <?php echo esc_attr( $form['pinterest_wrapper_class'] ?? '' ); ?>">
<?php
if ( ! empty( $form['type'] ) ) {
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->render_partial( path_join( 'inputs/', $form['type'] ), array( 'input' => $form ) );
}
if ( ! empty( $form['children'] ) ) {
foreach ( $form['children'] as $form ) {
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->render_partial( 'inputs/form', array( 'form' => $form ) );
}
}
?>
</div>

View File

@@ -0,0 +1,48 @@
<?php
/**
* Google Category Input.
*
* @package Automattic\WooCommerce\Pinterest\View\PHPView
*/
declare( strict_types=1 );
use Automattic\WooCommerce\Pinterest\View\PHPView;
defined( 'ABSPATH' ) || exit;
/**
* PHP View.
*
* @var PHPView $this
*/
/**
* Input.
*
* @var array $input
*/
$input = $this->input;
$input['class'] = $input['class'] ?? '';
$input['wrapper_class'] = $input['wrapper_class'] ?? '';
$input['name'] = $input['name'] ?? $input['id'];
$input['value'] = $input['value'] ?? '';
$input['desc_tip'] = $input['desc_tip'] ?? false;
?>
<p class="form-field <?php echo esc_attr( $input['id'] ); ?>_field pinterest-input-google-category <?php echo esc_attr( $input['wrapper_class'] ); ?>">
<label for="<?php echo esc_attr( $input['id'] ); ?>_google_category"><?php echo wp_kses_post( $input['label'] ); ?></label>
<select class="wc-product-search" style="width: 50%;" id="<?php echo esc_attr( $input['id'] ); ?>" name="<?php echo esc_attr( $input['name'] ); ?>" data-placeholder="<?php esc_attr_e( 'Search for a category…', 'pinterest-for-woocommerce' ); ?>" data-action="woocommerce_json_search_google_category" data-allow_clear="yes">
<?php echo '<option value="' . esc_attr( $input['value'] ) . '"' . selected( true, true, false ) . '>' . esc_html( wp_strip_all_tags( $input['value'] ) ) . '</option>'; ?>
</select>
<?php
if ( ! empty( $input['description'] ) && false !== $input['desc_tip'] ) {
echo wc_help_tip( $input['description'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
if ( ! empty( $input['description'] ) && false === $input['desc_tip'] ) {
echo '<span class="description">' . wp_kses_post( $input['description'] ) . '</span>';
}
?>
</p>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Input.
*
* @package Automattic\WooCommerce\Pinterest\View\PHPView
*/
declare( strict_types=1 );
defined( 'ABSPATH' ) || exit;
/**
* PHP View.
*
* @var \Automattic\WooCommerce\Pinterest\View\PHPView $this
*/
/**
* Input.
*
* @var array $input
*/
$input = $this->input;
woocommerce_wp_select( $input );