first commit

This commit is contained in:
CHIEFSOFT\ameye
2023-11-30 13:20:54 -05:00
commit e9e5c0546c
5833 changed files with 1801865 additions and 0 deletions
@@ -0,0 +1,47 @@
<?php
/**
* About Widget
*
* @package Powerkit
* @subpackage Modules
*/
if ( class_exists( 'Powerkit_Module' ) ) {
/**
* Init module
*/
class Powerkit_Widget_About extends Powerkit_Module {
/**
* Register module
*/
public function register() {
$this->name = esc_html__( 'About Widget', 'powerkit' );
$this->desc = esc_html__( 'Display Image, Text and Social Accounts.', 'powerkit' );
$this->slug = 'widget_about';
$this->type = 'default';
$this->category = 'widget';
$this->priority = 155;
$this->public = true;
$this->enabled = true;
}
/**
* Initialize module
*/
public function initialize() {
// Helpers Functions for the module.
require_once dirname( __FILE__ ) . '/helpers/helper-powerkit-about.php';
// The classes responsible for defining all actions.
require_once dirname( __FILE__ ) . '/public/class-powerkit-widget-about-init.php';
// Admin and public area.
require_once dirname( __FILE__ ) . '/public/class-powerkit-widget-about-public.php';
new Powerkit_Widget_About_Public( $this->slug );
}
}
new Powerkit_Widget_About();
}
@@ -0,0 +1,58 @@
<?php
/**
* Helpers About
*
* @package Powerkit
* @subpackage Modules/Helper
*/
/**
* Get html of about block
*
* @param array $params Recent options.
*/
function powerkit_about_get_html( $params ) {
// Image.
if ( $params['image'] ) {
$image = sprintf( '<div class="pk-about-media"><img src="%s" alt="about"></div>', esc_url( $params['image'] ) );
echo wp_kses_post( apply_filters( 'powerkit_lazy_process_images', $image ) );
}
// Title.
if ( isset( $params['widget_title'] ) && $params['widget_title'] ) {
echo wp_kses_post( apply_filters( 'powerkit_widget_about_title', $params['widget_title'], $params['title'] ) );
}
// Subtitle.
if ( $params['subtitle'] ) {
echo sprintf( '<p class="pk-about-small">%1$s</p>', wp_kses_post( $params['subtitle'] ) );
}
// Text.
if ( $params['text'] ) {
echo sprintf( '<div class="pk-about-content">%1$s</div>', wp_kses_post( $params['text'] ) );
}
?>
<?php
if ( ! empty( $params['button_url'] ) && ! empty( $params['button_text'] ) ) {
$text = apply_filters( 'powerkit_widget_about_button', $params['button_text'] );
if ( isset( $params['is_block'] ) && isset( $params['block_attrs'] ) && $params['is_block'] ) {
powerkit_print_gutenberg_blocks_button( $text, $params['button_url'], '', 'button', $params['block_attrs'] );
} else {
?>
<a href="<?php echo esc_url( $params['button_url'], null, '' ); ?>" class="pk-about-button button">
<?php echo wp_kses( $text, 'post' ); ?>
</a>
<?php
}
}
?>
<?php
if ( $params['social_links'] && powerkit_module_enabled( 'social_links' ) ) {
powerkit_social_links( false, false, false, 'inline', 'light', 'mixed', 5 );
}
}
@@ -0,0 +1,138 @@
<?php
/**
* Widget About
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package Powerkit
* @subpackage Powerkit/widgets
*/
/**
* Widget About
*/
class Powerkit_Widget_About_Init extends WP_Widget {
/**
* Sets up a new widget instance.
*/
public function __construct() {
$this->default_settings = apply_filters( 'powerkit_widget_about_settings', array(
'title' => esc_html__( 'About', 'powerkit' ),
'subtitle' => '',
'image' => false,
'text' => '',
'button_url' => '',
'button_text' => '',
'social_links' => true,
) );
$widget_details = array(
'classname' => 'powerkit_widget_about',
'description' => '',
);
parent::__construct( 'powerkit_widget_about', esc_html__( 'About', 'powerkit' ), $widget_details );
}
/**
* Outputs the content for the current widget instance.
*
* @param array $args Display arguments including 'before_title', 'after_title',
* 'before_widget', and 'after_widget'.
* @param array $instance Settings for the current widget instance.
*/
public function widget( $args, $instance ) {
$params = array_merge( $this->default_settings, $instance );
// Title.
if ( $params['title'] ) {
$params['widget_title'] = $args['before_title'] . apply_filters( 'widget_title', wp_kses( $params['title'], 'pk-title' ), $instance, $this->id_base ) . $args['after_title'];
}
// Before Widget.
echo $args['before_widget']; // XSS.
?>
<div class="widget-body pk-widget-about">
<?php
powerkit_about_get_html( $params );
?>
</div>
<?php
// After Widget.
echo $args['after_widget']; // XSS.
}
/**
* Handles updating settings for the current widget instance.
*
* @param array $new_instance New settings for this instance as input by the user via
* WP_Widget::form().
* @param array $old_instance Old settings for this instance.
* @return array Settings to save or bool false to cancel saving.
*/
public function update( $new_instance, $old_instance ) {
$instance = $new_instance;
// Display social links.
if ( ! isset( $instance['social_links'] ) ) {
$instance['social_links'] = false;
}
return $instance;
}
/**
* Outputs the widget settings form.
*
* @param array $instance Current settings.
*/
public function form( $instance ) {
$params = array_merge( $this->default_settings, $instance );
$bg_image_url = $params['image'] ? wp_get_attachment_image_url( intval( $params['image'] ), 'large' ) : '';
?>
<!-- Title -->
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'powerkit' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $params['title'] ); ?>" /></p>
<!-- Subtitle -->
<p><label for="<?php echo esc_attr( $this->get_field_id( 'subtitle' ) ); ?>"><?php esc_html_e( 'Subtitle', 'powerkit' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'subtitle' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'subtitle' ) ); ?>" type="text" value="<?php echo esc_attr( $params['subtitle'] ); ?>" /></p>
<!-- Image URL -->
<p><label for="<?php echo esc_attr( $this->get_field_id( 'image' ) ); ?>"><?php esc_html_e( 'Image URL', 'powerkit' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'image' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'image' ) ); ?>" type="text" value="<?php echo esc_attr( $params['image'] ); ?>" /></p>
<!-- Text -->
<p><label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php esc_html_e( 'Text', 'powerkit' ); ?></label>
<textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>" rows="10"><?php echo esc_textarea( $params['text'] ); ?></textarea></p>
<!-- Button URL -->
<p><label for="<?php echo esc_attr( $this->get_field_id( 'button_url' ) ); ?>"><?php esc_html_e( 'Button URL', 'powerkit' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'button_url' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button_url' ) ); ?>" type="text" value="<?php echo esc_attr( $params['button_url'] ); ?>" /></p>
<!-- Button Text -->
<p><label for="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>"><?php esc_html_e( 'Button Text', 'powerkit' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button_text' ) ); ?>" type="text" value="<?php echo esc_attr( $params['button_text'] ); ?>" /></p>
<!-- Display social accounts -->
<?php if ( powerkit_module_enabled( 'social_links' ) ) : ?>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'social_links' ) ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'social_links' ) ); ?>" type="checkbox" <?php checked( (bool) $params['social_links'] ); ?> />
<label for="<?php echo esc_attr( $this->get_field_id( 'social_links' ) ); ?>"><?php esc_html_e( 'Display social links', 'powerkit' ); ?></label></p>
<?php endif; ?>
<?php
}
}
/**
* Register Widget
*/
function powerkit_widget_about_init() {
register_widget( 'Powerkit_Widget_About_Init' );
}
add_action( 'widgets_init', 'powerkit_widget_about_init' );
@@ -0,0 +1,43 @@
<?php
/**
* The public-facing functionality of the module.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package Powerkit
* @subpackage Modules/public
*/
/**
* The public-facing functionality of the module.
*/
class Powerkit_Widget_About_Public extends Powerkit_Module_Public {
/**
* Initialize
*/
public function initialize() {
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
}
/**
* Register the stylesheets for the public-facing side of the site.
*/
public function wp_enqueue_scripts() {
wp_enqueue_style( 'powerkit-widget-about', powerkit_style( plugin_dir_url( __FILE__ ) . 'css/public-powerkit-widget-about.css' ), array(), powerkit_get_setting( 'version' ), 'all' );
// Add RTL support.
wp_style_add_data( 'powerkit-widget-about', 'rtl', 'replace' );
}
/**
* Register the stylesheets for the admin-facing side of the site.
*/
public function admin_enqueue_scripts() {
wp_enqueue_style( 'powerkit-widget-about', powerkit_style( plugin_dir_url( __FILE__ ) . 'css/public-powerkit-widget-about.css' ), array(), powerkit_get_setting( 'version' ), 'all' );
// Add RTL support.
wp_style_add_data( 'powerkit-widget-about', 'rtl', 'replace' );
}
}
@@ -0,0 +1,65 @@
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.pk-widget-about,
.pk-block-about {
--pk-about-small-color: #adb5bd;
}
/*--------------------------------------------------------------*/
.pk-widget-about,
.pk-block-about {
text-align: center;
}
.pk-widget-about .pk-about-media,
.pk-block-about .pk-about-media {
margin-bottom: 1rem;
}
.pk-widget-about .pk-about-media img,
.pk-block-about .pk-about-media img {
max-width: 100%;
}
.pk-widget-about .pk-about-content,
.pk-widget-about .pk-about-small,
.pk-widget-about .pk-about-button,
.pk-widget-about .pk-social-links-wrap,
.pk-block-about .pk-about-content,
.pk-block-about .pk-about-small,
.pk-block-about .pk-about-button,
.pk-block-about .pk-social-links-wrap {
margin-top: 1rem;
margin-bottom: 0;
}
.pk-widget-about .pk-about-small,
.pk-block-about .pk-about-small {
color: var(--pk-about-small-color);
}
.pk-widget-about .pk-about-button,
.pk-block-about .pk-about-button {
display: inline-block;
}
.pk-widget-about .pk-social-links-items,
.pk-block-about .pk-social-links-items {
justify-content: center;
}
.pk-widget-about .pk-social-links-item,
.pk-block-about .pk-social-links-item {
min-width: 2rem;
}
.widget .pk-widget-about .title-widget {
margin: 0;
}
@@ -0,0 +1,65 @@
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.pk-widget-about,
.pk-block-about {
--pk-about-small-color: #adb5bd;
}
/*--------------------------------------------------------------*/
.pk-widget-about,
.pk-block-about {
text-align: center;
}
.pk-widget-about .pk-about-media,
.pk-block-about .pk-about-media {
margin-bottom: 1rem;
}
.pk-widget-about .pk-about-media img,
.pk-block-about .pk-about-media img {
max-width: 100%;
}
.pk-widget-about .pk-about-content,
.pk-widget-about .pk-about-small,
.pk-widget-about .pk-about-button,
.pk-widget-about .pk-social-links-wrap,
.pk-block-about .pk-about-content,
.pk-block-about .pk-about-small,
.pk-block-about .pk-about-button,
.pk-block-about .pk-social-links-wrap {
margin-top: 1rem;
margin-bottom: 0;
}
.pk-widget-about .pk-about-small,
.pk-block-about .pk-about-small {
color: var(--pk-about-small-color);
}
.pk-widget-about .pk-about-button,
.pk-block-about .pk-about-button {
display: inline-block;
}
.pk-widget-about .pk-social-links-items,
.pk-block-about .pk-social-links-items {
justify-content: center;
}
.pk-widget-about .pk-social-links-item,
.pk-block-about .pk-social-links-item {
min-width: 2rem;
}
.widget .pk-widget-about .title-widget {
margin: 0;
}