Fix: Apply latest phpcbf formatting fixes
This commit is contained in:
@@ -4,122 +4,132 @@
|
|||||||
* @package WPALLSTARS\PluginStarterTemplate
|
* @package WPALLSTARS\PluginStarterTemplate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function($) {
|
(function ($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin functionality
|
* Admin functionality
|
||||||
*/
|
*/
|
||||||
const WPSTAdmin = {
|
const WPSTAdmin = {
|
||||||
/**
|
/**
|
||||||
* Initialize
|
* Initialize
|
||||||
*/
|
*/
|
||||||
init: function() {
|
init: function () {
|
||||||
// Initialize components
|
// Initialize components
|
||||||
this.initComponents();
|
this.initComponents();
|
||||||
|
|
||||||
// Bind events
|
|
||||||
this.bindEvents();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// Bind events
|
||||||
* Initialize components
|
this.bindEvents();
|
||||||
*/
|
},
|
||||||
initComponents: function() {
|
|
||||||
// Initialize any components here
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind events
|
* Initialize components
|
||||||
*/
|
*/
|
||||||
bindEvents: function() {
|
initComponents: function () {
|
||||||
// Example: Toggle sections
|
// Initialize any components here
|
||||||
$('.wpst-toggle-section').on('click', this.toggleSection);
|
},
|
||||||
|
|
||||||
// Example: Form submission
|
|
||||||
$('#wpst-settings-form').on('submit', this.handleFormSubmit);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle section visibility
|
* Bind events
|
||||||
*
|
*/
|
||||||
* @param {Event} e Click event
|
bindEvents: function () {
|
||||||
*/
|
// Example: Toggle sections
|
||||||
toggleSection: function(e) {
|
$( '.wpst-toggle-section' ).on( 'click', this.toggleSection );
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
const $this = $(this);
|
|
||||||
const target = $this.data('target');
|
|
||||||
|
|
||||||
$(target).slideToggle(200);
|
|
||||||
$this.toggleClass('open');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// Example: Form submission
|
||||||
* Handle form submission
|
$( '#wpst-settings-form' ).on( 'submit', this.handleFormSubmit );
|
||||||
*
|
},
|
||||||
* @param {Event} e Submit event
|
|
||||||
*/
|
|
||||||
handleFormSubmit: function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
const $form = $(this);
|
|
||||||
const $submitButton = $form.find('input[type="submit"]');
|
|
||||||
const formData = $form.serialize();
|
|
||||||
|
|
||||||
// Disable submit button and show loading state
|
|
||||||
$submitButton.prop('disabled', true).addClass('loading');
|
|
||||||
|
|
||||||
// Send AJAX request
|
|
||||||
$.ajax({
|
|
||||||
url: wpstData.ajaxUrl,
|
|
||||||
type: 'POST',
|
|
||||||
data: {
|
|
||||||
action: 'wpst_save_settings',
|
|
||||||
nonce: wpstData.nonce,
|
|
||||||
formData: formData
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
if (response.success) {
|
|
||||||
WPSTAdmin.showNotice('success', response.data.message);
|
|
||||||
} else {
|
|
||||||
WPSTAdmin.showNotice('error', response.data.message);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
WPSTAdmin.showNotice('error', 'An error occurred. Please try again.');
|
|
||||||
},
|
|
||||||
complete: function() {
|
|
||||||
// Re-enable submit button and remove loading state
|
|
||||||
$submitButton.prop('disabled', false).removeClass('loading');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show admin notice
|
* Toggle section visibility
|
||||||
*
|
*
|
||||||
* @param {string} type Notice type (success, error, warning)
|
* @param {Event} e Click event
|
||||||
* @param {string} message Notice message
|
*/
|
||||||
*/
|
toggleSection: function (e) {
|
||||||
showNotice: function(type, message) {
|
e.preventDefault();
|
||||||
const $notice = $('<div class="wpst-notice ' + type + '"><p>' + message + '</p></div>');
|
|
||||||
|
|
||||||
// Add notice to the page
|
|
||||||
$('.wpst-notices').html($notice);
|
|
||||||
|
|
||||||
// Automatically remove notice after 5 seconds
|
|
||||||
setTimeout(function() {
|
|
||||||
$notice.fadeOut(300, function() {
|
|
||||||
$(this).remove();
|
|
||||||
});
|
|
||||||
}, 5000);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Initialize when document is ready
|
const $this = $( this );
|
||||||
$(document).ready(function() {
|
const target = $this.data( 'target' );
|
||||||
WPSTAdmin.init();
|
|
||||||
});
|
|
||||||
|
|
||||||
})(jQuery);
|
$( target ).slideToggle( 200 );
|
||||||
|
$this.toggleClass( 'open' );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle form submission
|
||||||
|
*
|
||||||
|
* @param {Event} e Submit event
|
||||||
|
*/
|
||||||
|
handleFormSubmit: function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const $form = $( this );
|
||||||
|
const $submitButton = $form.find( 'input[type="submit"]' );
|
||||||
|
const formData = $form.serialize();
|
||||||
|
|
||||||
|
// Disable submit button and show loading state
|
||||||
|
$submitButton.prop( 'disabled', true ).addClass( 'loading' );
|
||||||
|
|
||||||
|
// Send AJAX request
|
||||||
|
$.ajax(
|
||||||
|
{
|
||||||
|
url: wpstData.ajaxUrl,
|
||||||
|
type: 'POST',
|
||||||
|
data: {
|
||||||
|
action: 'wpst_save_settings',
|
||||||
|
nonce: wpstData.nonce,
|
||||||
|
formData: formData
|
||||||
|
},
|
||||||
|
success: function (response) {
|
||||||
|
if (response.success) {
|
||||||
|
WPSTAdmin.showNotice( 'success', response.data.message );
|
||||||
|
} else {
|
||||||
|
WPSTAdmin.showNotice( 'error', response.data.message );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
WPSTAdmin.showNotice( 'error', 'An error occurred. Please try again.' );
|
||||||
|
},
|
||||||
|
complete: function () {
|
||||||
|
// Re-enable submit button and remove loading state
|
||||||
|
$submitButton.prop( 'disabled', false ).removeClass( 'loading' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show admin notice
|
||||||
|
*
|
||||||
|
* @param {string} type Notice type (success, error, warning)
|
||||||
|
* @param {string} message Notice message
|
||||||
|
*/
|
||||||
|
showNotice: function (type, message) {
|
||||||
|
const $notice = $( '<div class="wpst-notice ' + type + '"><p>' + message + '</p></div>' );
|
||||||
|
|
||||||
|
// Add notice to the page
|
||||||
|
$( '.wpst-notices' ).html( $notice );
|
||||||
|
|
||||||
|
// Automatically remove notice after 5 seconds
|
||||||
|
setTimeout(
|
||||||
|
function () {
|
||||||
|
$notice.fadeOut(
|
||||||
|
300,
|
||||||
|
function () {
|
||||||
|
$( this ).remove();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
5000
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Initialize when document is ready
|
||||||
|
$( document ).ready(
|
||||||
|
function () {
|
||||||
|
WPSTAdmin.init();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
})( jQuery );
|
||||||
|
|||||||
@@ -4,161 +4,175 @@
|
|||||||
* @package WPALLSTARS\PluginStarterTemplate
|
* @package WPALLSTARS\PluginStarterTemplate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function($) {
|
(function ($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update Source Selector functionality
|
* Update Source Selector functionality
|
||||||
*/
|
*/
|
||||||
const WPSTUpdateSourceSelector = {
|
const WPSTUpdateSourceSelector = {
|
||||||
/**
|
/**
|
||||||
* Modal element
|
* Modal element
|
||||||
*/
|
*/
|
||||||
$modal: null,
|
$modal: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selected source
|
* Selected source
|
||||||
*/
|
*/
|
||||||
selectedSource: '',
|
selectedSource: '',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize
|
* Initialize
|
||||||
*/
|
*/
|
||||||
init: function() {
|
init: function () {
|
||||||
// Cache DOM elements
|
// Cache DOM elements
|
||||||
this.$modal = $('#wpst-update-source-modal');
|
this.$modal = $( '#wpst-update-source-modal' );
|
||||||
|
|
||||||
// Bind events
|
|
||||||
this.bindEvents();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// Bind events
|
||||||
* Bind events
|
this.bindEvents();
|
||||||
*/
|
},
|
||||||
bindEvents: function() {
|
|
||||||
// Open modal when clicking on the update source link
|
|
||||||
$(document).on('click', '.wpst-update-source-selector', this.openModal.bind(this));
|
|
||||||
|
|
||||||
// Close modal when clicking on the close button or outside the modal
|
|
||||||
this.$modal.on('click', '.wpst-modal-close', this.closeModal.bind(this));
|
|
||||||
$(document).on('click', '.wpst-modal', function(e) {
|
|
||||||
if ($(e.target).hasClass('wpst-modal')) {
|
|
||||||
WPSTUpdateSourceSelector.closeModal();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Select source option
|
|
||||||
this.$modal.on('click', '.wpst-source-option', this.selectSource.bind(this));
|
|
||||||
|
|
||||||
// Save source selection
|
|
||||||
this.$modal.on('click', '#wpst-save-source', this.saveSource.bind(this));
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the modal
|
* Bind events
|
||||||
*
|
*/
|
||||||
* @param {Event} e Click event
|
bindEvents: function () {
|
||||||
*/
|
// Open modal when clicking on the update source link
|
||||||
openModal: function(e) {
|
$( document ).on( 'click', '.wpst-update-source-selector', this.openModal.bind( this ) );
|
||||||
e.preventDefault();
|
|
||||||
this.$modal.show();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// Close modal when clicking on the close button or outside the modal
|
||||||
* Close the modal
|
this.$modal.on( 'click', '.wpst-modal-close', this.closeModal.bind( this ) );
|
||||||
*/
|
$( document ).on(
|
||||||
closeModal: function() {
|
'click',
|
||||||
this.$modal.hide();
|
'.wpst-modal',
|
||||||
},
|
function (e) {
|
||||||
|
if ($( e.target ).hasClass( 'wpst-modal' )) {
|
||||||
|
WPSTUpdateSourceSelector.closeModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
// Select source option
|
||||||
* Select a source option
|
this.$modal.on( 'click', '.wpst-source-option', this.selectSource.bind( this ) );
|
||||||
*
|
|
||||||
* @param {Event} e Click event
|
|
||||||
*/
|
|
||||||
selectSource: function(e) {
|
|
||||||
const $option = $(e.currentTarget);
|
|
||||||
|
|
||||||
// Update selected state
|
|
||||||
this.$modal.find('.wpst-source-option').removeClass('selected');
|
|
||||||
$option.addClass('selected');
|
|
||||||
|
|
||||||
// Update radio button
|
|
||||||
$option.find('input[type="radio"]').prop('checked', true);
|
|
||||||
|
|
||||||
// Store selected source
|
|
||||||
this.selectedSource = $option.find('input[type="radio"]').val();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// Save source selection
|
||||||
* Save the selected source
|
this.$modal.on( 'click', '#wpst-save-source', this.saveSource.bind( this ) );
|
||||||
*/
|
},
|
||||||
saveSource: function() {
|
|
||||||
// Validate selection
|
|
||||||
if (!this.selectedSource) {
|
|
||||||
this.showMessage('error', 'Please select an update source.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show loading state
|
|
||||||
const $saveButton = $('#wpst-save-source');
|
|
||||||
$saveButton.prop('disabled', true).html('<span class="wpst-loading"></span> Saving...');
|
|
||||||
|
|
||||||
// Send AJAX request
|
|
||||||
$.ajax({
|
|
||||||
url: wpstModalData.ajaxUrl,
|
|
||||||
type: 'POST',
|
|
||||||
data: {
|
|
||||||
action: 'wpst_set_update_source',
|
|
||||||
nonce: wpstModalData.nonce,
|
|
||||||
source: this.selectedSource
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
if (response.success) {
|
|
||||||
WPSTUpdateSourceSelector.showMessage('success', response.data.message);
|
|
||||||
|
|
||||||
// Close modal after a short delay
|
|
||||||
setTimeout(function() {
|
|
||||||
WPSTUpdateSourceSelector.closeModal();
|
|
||||||
}, 1500);
|
|
||||||
} else {
|
|
||||||
WPSTUpdateSourceSelector.showMessage('error', response.data.message);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
WPSTUpdateSourceSelector.showMessage('error', 'An error occurred. Please try again.');
|
|
||||||
},
|
|
||||||
complete: function() {
|
|
||||||
// Reset button state
|
|
||||||
$saveButton.prop('disabled', false).text(wpstModalData.i18n.confirm);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a message in the modal
|
* Open the modal
|
||||||
*
|
*
|
||||||
* @param {string} type Message type (success, error)
|
* @param {Event} e Click event
|
||||||
* @param {string} message Message text
|
*/
|
||||||
*/
|
openModal: function (e) {
|
||||||
showMessage: function(type, message) {
|
e.preventDefault();
|
||||||
const $message = this.$modal.find('.wpst-modal-message');
|
this.$modal.show();
|
||||||
|
},
|
||||||
// Set message content and type
|
|
||||||
$message.html(message).removeClass('success error').addClass(type).show();
|
|
||||||
|
|
||||||
// Hide message after a delay for success messages
|
|
||||||
if (type === 'success') {
|
|
||||||
setTimeout(function() {
|
|
||||||
$message.fadeOut(300);
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Initialize when document is ready
|
/**
|
||||||
$(document).ready(function() {
|
* Close the modal
|
||||||
WPSTUpdateSourceSelector.init();
|
*/
|
||||||
});
|
closeModal: function () {
|
||||||
|
this.$modal.hide();
|
||||||
|
},
|
||||||
|
|
||||||
})(jQuery);
|
/**
|
||||||
|
* Select a source option
|
||||||
|
*
|
||||||
|
* @param {Event} e Click event
|
||||||
|
*/
|
||||||
|
selectSource: function (e) {
|
||||||
|
const $option = $( e.currentTarget );
|
||||||
|
|
||||||
|
// Update selected state
|
||||||
|
this.$modal.find( '.wpst-source-option' ).removeClass( 'selected' );
|
||||||
|
$option.addClass( 'selected' );
|
||||||
|
|
||||||
|
// Update radio button
|
||||||
|
$option.find( 'input[type="radio"]' ).prop( 'checked', true );
|
||||||
|
|
||||||
|
// Store selected source
|
||||||
|
this.selectedSource = $option.find( 'input[type="radio"]' ).val();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the selected source
|
||||||
|
*/
|
||||||
|
saveSource: function () {
|
||||||
|
// Validate selection
|
||||||
|
if ( ! this.selectedSource) {
|
||||||
|
this.showMessage( 'error', 'Please select an update source.' );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show loading state
|
||||||
|
const $saveButton = $( '#wpst-save-source' );
|
||||||
|
$saveButton.prop( 'disabled', true ).html( '<span class="wpst-loading"></span> Saving...' );
|
||||||
|
|
||||||
|
// Send AJAX request
|
||||||
|
$.ajax(
|
||||||
|
{
|
||||||
|
url: wpstModalData.ajaxUrl,
|
||||||
|
type: 'POST',
|
||||||
|
data: {
|
||||||
|
action: 'wpst_set_update_source',
|
||||||
|
nonce: wpstModalData.nonce,
|
||||||
|
source: this.selectedSource
|
||||||
|
},
|
||||||
|
success: function (response) {
|
||||||
|
if (response.success) {
|
||||||
|
WPSTUpdateSourceSelector.showMessage( 'success', response.data.message );
|
||||||
|
|
||||||
|
// Close modal after a short delay
|
||||||
|
setTimeout(
|
||||||
|
function () {
|
||||||
|
WPSTUpdateSourceSelector.closeModal();
|
||||||
|
},
|
||||||
|
1500
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
WPSTUpdateSourceSelector.showMessage( 'error', response.data.message );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
WPSTUpdateSourceSelector.showMessage( 'error', 'An error occurred. Please try again.' );
|
||||||
|
},
|
||||||
|
complete: function () {
|
||||||
|
// Reset button state
|
||||||
|
$saveButton.prop( 'disabled', false ).text( wpstModalData.i18n.confirm );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a message in the modal
|
||||||
|
*
|
||||||
|
* @param {string} type Message type (success, error)
|
||||||
|
* @param {string} message Message text
|
||||||
|
*/
|
||||||
|
showMessage: function (type, message) {
|
||||||
|
const $message = this.$modal.find( '.wpst-modal-message' );
|
||||||
|
|
||||||
|
// Set message content and type
|
||||||
|
$message.html( message ).removeClass( 'success error' ).addClass( type ).show();
|
||||||
|
|
||||||
|
// Hide message after a delay for success messages
|
||||||
|
if (type === 'success') {
|
||||||
|
setTimeout(
|
||||||
|
function () {
|
||||||
|
$message.fadeOut( 300 );
|
||||||
|
},
|
||||||
|
3000
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Initialize when document is ready
|
||||||
|
$( document ).ready(
|
||||||
|
function () {
|
||||||
|
WPSTUpdateSourceSelector.init();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
})( jQuery );
|
||||||
|
|||||||
@@ -6,60 +6,60 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// If this file is called directly, abort.
|
// If this file is called directly, abort.
|
||||||
if (!defined('WPINC')) {
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- Update Source Modal -->
|
<!-- Update Source Modal -->
|
||||||
<div id="wpst-update-source-modal" class="wpst-modal">
|
<div id="wpst-update-source-modal" class="wpst-modal">
|
||||||
<div class="wpst-modal-content">
|
<div class="wpst-modal-content">
|
||||||
<div class="wpst-modal-header">
|
<div class="wpst-modal-header">
|
||||||
<h2 class="wpst-modal-title"><?php esc_html_e('Select Update Source', 'wp-plugin-starter-template'); ?></h2>
|
<h2 class="wpst-modal-title"><?php esc_html_e( 'Select Update Source', 'wp-plugin-starter-template' ); ?></h2>
|
||||||
<span class="wpst-modal-close">×</span>
|
<span class="wpst-modal-close">×</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="wpst-modal-body">
|
<div class="wpst-modal-body">
|
||||||
<p><?php esc_html_e('Choose your preferred source for plugin updates:', 'wp-plugin-starter-template'); ?></p>
|
<p><?php esc_html_e( 'Choose your preferred source for plugin updates:', 'wp-plugin-starter-template' ); ?></p>
|
||||||
|
|
||||||
<div class="wpst-modal-message"></div>
|
<div class="wpst-modal-message"></div>
|
||||||
|
|
||||||
<div class="wpst-source-options">
|
<div class="wpst-source-options">
|
||||||
<?php
|
<?php
|
||||||
// Get current update source
|
// Get current update source
|
||||||
$current_source = get_option('wpst_update_source', 'wordpress.org');
|
$current_source = get_option( 'wpst_update_source', 'wordpress.org' );
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<label class="wpst-source-option <?php echo $current_source === 'wordpress.org' ? 'selected' : ''; ?>">
|
<label class="wpst-source-option <?php echo $current_source === 'wordpress.org' ? 'selected' : ''; ?>">
|
||||||
<input type="radio" name="update_source" value="wordpress.org" <?php checked($current_source, 'wordpress.org'); ?>>
|
<input type="radio" name="update_source" value="wordpress.org" <?php checked( $current_source, 'wordpress.org' ); ?>>
|
||||||
<span class="wpst-source-option-label"><?php esc_html_e('WordPress.org', 'wp-plugin-starter-template'); ?></span>
|
<span class="wpst-source-option-label"><?php esc_html_e( 'WordPress.org', 'wp-plugin-starter-template' ); ?></span>
|
||||||
<div class="wpst-source-option-description">
|
<div class="wpst-source-option-description">
|
||||||
<?php esc_html_e('Receive updates from the official WordPress.org repository. Recommended for most users.', 'wp-plugin-starter-template'); ?>
|
<?php esc_html_e( 'Receive updates from the official WordPress.org repository. Recommended for most users.', 'wp-plugin-starter-template' ); ?>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="wpst-source-option <?php echo $current_source === 'github' ? 'selected' : ''; ?>">
|
<label class="wpst-source-option <?php echo $current_source === 'github' ? 'selected' : ''; ?>">
|
||||||
<input type="radio" name="update_source" value="github" <?php checked($current_source, 'github'); ?>>
|
<input type="radio" name="update_source" value="github" <?php checked( $current_source, 'github' ); ?>>
|
||||||
<span class="wpst-source-option-label"><?php esc_html_e('GitHub', 'wp-plugin-starter-template'); ?></span>
|
<span class="wpst-source-option-label"><?php esc_html_e( 'GitHub', 'wp-plugin-starter-template' ); ?></span>
|
||||||
<div class="wpst-source-option-description">
|
<div class="wpst-source-option-description">
|
||||||
<?php esc_html_e('Receive updates from the GitHub repository. May include pre-release versions.', 'wp-plugin-starter-template'); ?>
|
<?php esc_html_e( 'Receive updates from the GitHub repository. May include pre-release versions.', 'wp-plugin-starter-template' ); ?>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="wpst-source-option <?php echo $current_source === 'gitea' ? 'selected' : ''; ?>">
|
<label class="wpst-source-option <?php echo $current_source === 'gitea' ? 'selected' : ''; ?>">
|
||||||
<input type="radio" name="update_source" value="gitea" <?php checked($current_source, 'gitea'); ?>>
|
<input type="radio" name="update_source" value="gitea" <?php checked( $current_source, 'gitea' ); ?>>
|
||||||
<span class="wpst-source-option-label"><?php esc_html_e('Gitea', 'wp-plugin-starter-template'); ?></span>
|
<span class="wpst-source-option-label"><?php esc_html_e( 'Gitea', 'wp-plugin-starter-template' ); ?></span>
|
||||||
<div class="wpst-source-option-description">
|
<div class="wpst-source-option-description">
|
||||||
<?php esc_html_e('Receive updates from the Gitea repository. May include pre-release versions.', 'wp-plugin-starter-template'); ?>
|
<?php esc_html_e( 'Receive updates from the Gitea repository. May include pre-release versions.', 'wp-plugin-starter-template' ); ?>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="wpst-modal-footer">
|
<div class="wpst-modal-footer">
|
||||||
<button type="button" id="wpst-save-source" class="button button-primary">
|
<button type="button" id="wpst-save-source" class="button button-primary">
|
||||||
<?php esc_html_e('Save', 'wp-plugin-starter-template'); ?>
|
<?php esc_html_e( 'Save', 'wp-plugin-starter-template' ); ?>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,43 +12,43 @@ namespace WPALLSTARS\PluginStarterTemplate;
|
|||||||
*/
|
*/
|
||||||
class Plugin {
|
class Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core instance
|
* Core instance
|
||||||
*
|
*
|
||||||
* @var Core
|
* @var Core
|
||||||
*/
|
*/
|
||||||
private $core;
|
private $core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin file
|
* Plugin file
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $plugin_file;
|
private $plugin_file;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin version
|
* Plugin version
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $version;
|
private $version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param string $plugin_file Main plugin file path.
|
* @param string $plugin_file Main plugin file path.
|
||||||
* @param string $version Plugin version.
|
* @param string $version Plugin version.
|
||||||
*/
|
*/
|
||||||
public function __construct($plugin_file, $version) {
|
public function __construct( $plugin_file, $version ) {
|
||||||
$this->plugin_file = $plugin_file;
|
$this->plugin_file = $plugin_file;
|
||||||
$this->version = $version;
|
$this->version = $version;
|
||||||
$this->core = new Core();
|
$this->core = new Core();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the plugin
|
* Initialize the plugin
|
||||||
*/
|
*/
|
||||||
public function init() {
|
public function init() {
|
||||||
// Initialize plugin
|
// Initialize plugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,12 +27,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// If this file is called directly, abort.
|
// If this file is called directly, abort.
|
||||||
if (!defined('WPINC')) {
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the main plugin class
|
// Load the main plugin class
|
||||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin.php';
|
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin.php';
|
||||||
|
|
||||||
// Initialize the plugin
|
// Initialize the plugin
|
||||||
new WPALLSTARS\PluginStarterTemplate\Plugin(__FILE__, '0.1.7');
|
new WPALLSTARS\PluginStarterTemplate\Plugin( __FILE__, '0.1.7' );
|
||||||
|
|||||||
Reference in New Issue
Block a user