File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/Widget.php.tar
var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/optinmonster/OMAPI/Elementor/Widget.php0000644 00000037646 15154200070 0030000 0 ustar 00 <?php
/**
* Elementor Widget class.
*
* @since 2.2.0
*
* @package OMAPI
* @author Justin Sternberg
*/
use Elementor\Plugin;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
/**
* OptinMonster widget for Elementor page builder.
*
* @since 2.2.0
*/
class OMAPI_Elementor_Widget extends Widget_Base {
/**
* Widget constructor.
*
* Initializing the widget class.
*
* @see https://code.elementor.com/methods/elementor-widget_base-__construct/
*
* @since 2.2.0
*
* @throws \Exception If arguments are missing when initializing a full widget
* instance.
*
* @param array $data Widget data. Default is an empty array.
* @param array|null $args Optional. Widget default arguments. Default is null.
*/
public function __construct( $data = array(), $args = null ) {
parent::__construct( $data, $args );
// Load the base class object.
$this->base = OMAPI::get_instance();
/*
* Increased priority to get around: https://github.com/elementor/elementor/issues/19709
*/
add_action( 'wp_enqueue_scripts', array( $this, 'register_js' ), 999 );
}
/**
* Register widget JS.
*
* @since 2.16.2
*/
public function register_js() {
$script_id = $this->base->plugin_slug . '-elementor';
wp_register_script(
$script_id,
$this->base->url . 'assets/dist/js/elementor.min.js',
array( 'jquery' ),
$this->base->asset_version(),
true
);
OMAPI_Utils::add_inline_script( $script_id, 'OMAPI', $this->base->blocks->get_data_for_js() );
}
/**
* Get widget name.
*
* Retrieve shortcode widget name.
*
* @see https://code.elementor.com/methods/elementor-controls_stack-get_name/
*
* @since 2.2.0
*
* @return string Widget name.
*/
public function get_name() {
return 'optinmonster';
}
/**
* Get widget title.
*
* Retrieve widget title.
*
* @see https://code.elementor.com/methods/elementor-element_base-get_title/
*
* @since 2.2.0
*
* @return string Widget title.
*/
public function get_title() {
return __( 'OptinMonster', 'optin-monster-api' );
}
/**
* Get widget icon.
*
* Retrieve widget icon.
*
* @see https://code.elementor.com/methods/elementor-widget_base-get_icon/
*
* @since 2.2.0
*
* @return string Widget icon.
*/
public function get_icon() {
return 'icon-optinmonster';
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @see https://code.elementor.com/methods/elementor-widget_base-get_keywords/
*
* @since 2.2.0
*
* @return array Widget keywords.
*/
public function get_keywords() {
return array(
'popup',
'form',
'forms',
'campaign',
'email',
'conversion',
'contact form',
);
}
/**
* Get widget categories.
*
* @see https://code.elementor.com/methods/elementor-widget_base-get_categories/
*
* @since 2.2.0
*
* @return array Widget categories.
*/
public function get_categories() {
return array(
'basic',
);
}
/**
* Handle registering elementor editor JS assets.
*
* @see https://code.elementor.com/methods/elementor-element_base-get_script_depends/
*
* @since 2.2.0
*
* @return array
*/
public function get_script_depends() {
return Plugin::instance()->preview->is_preview_mode()
? array( $this->base->plugin_slug . '-elementor' )
: array();
}
/**
* Handle registering elementor editor CSS assets.
*
* @see https://code.elementor.com/methods/elementor-element_base-get_style_depends/
*
* @since 2.2.0
*
* @return array
*/
public function get_style_depends() {
$css_handle = $this->base->plugin_slug . '-elementor-frontend';
wp_register_style(
$css_handle,
$this->base->url . 'assets/dist/css/elementor-frontend.min.css',
array(),
$this->base->asset_version()
);
return array( $css_handle );
}
/**
* Register widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @see https://code.elementor.com/methods/elementor-controls_stack-_register_controls/
*
* @since 2.2.0
*/
protected function register_controls() {
$this->start_controls_section(
'section_om_campaign',
array(
'label' => esc_html__( 'OptinMonster Campaign', 'optin-monster-api' ),
'tab' => Controls_Manager::TAB_CONTENT,
)
);
if ( ! $this->base->blocks->has_sites() ) {
$this->no_sites_controls();
} elseif ( ! $this->has_inline_campaigns() ) {
$this->no_campaign_controls();
} else {
$this->campaign_controls();
}
$this->end_controls_section();
}
/**
* Register no-site controls.
*
* @since 2.2.0
*/
protected function no_sites_controls() {
$i18n = $this->base->blocks->get_data_for_js( 'i18n' );
$this->add_control(
'add_om_campaign_notice',
array(
'show_label' => false,
'type' => Controls_Manager::RAW_HTML,
'raw' => '
<p class="om-elementor-editor-no_sites-help">
<strong>' . esc_html__( 'You Have Not Connected to OptinMonster', 'optin-monster-api' ) . '</strong>
<br>
' . esc_html__( 'Please create a Free Account or Connect an Existing Account', 'optin-monster-api' ) . '
</p>
',
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
)
);
$this->add_control(
'om_create_account',
array(
'show_label' => false,
'label_block' => false,
'type' => Controls_Manager::BUTTON,
'button_type' => 'default',
'text' => $i18n['no_sites_button_create_account'],
'event' => 'elementorOMAPICreateAccount',
)
);
$this->add_control(
'om_connect_account',
array(
'show_label' => false,
'label_block' => false,
'type' => Controls_Manager::BUTTON,
'button_type' => 'default',
'separator' => 'after',
'text' => $i18n['no_sites_button_connect_account'],
'event' => 'elementorOMAPIConnectAccount',
)
);
}
/**
* Register no-campaign controls.
*
* @since 2.2.0
*/
protected function no_campaign_controls() {
$this->add_control(
'add_om_campaign_notice',
array(
'show_label' => false,
'type' => Controls_Manager::RAW_HTML,
'raw' => wp_kses(
'<b>' . __( 'No inline campaigns available!', 'optin-monster-api' ) . '</b>',
array(
'b' => array(),
)
),
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
)
);
$this->add_control(
'add_campaign_btn',
array(
'show_label' => false,
'label_block' => false,
'type' => Controls_Manager::BUTTON,
'button_type' => 'default',
'separator' => 'after',
'text' => '<b>+</b>' . esc_html__( 'Create New Inline Campaign', 'optin-monster-api' ),
'event' => 'elementorOMAPIAddInlineBtnClick',
)
);
}
/**
* Register campaign controls.
*
* @since 2.2.0
*/
protected function campaign_controls() {
$campaigns = $this->base->blocks->get_campaign_options( true );
$campaigns = array_merge( array( '' => esc_html__( 'Select Campaign...', 'optin-monster-api' ) ), $campaigns['inline'] );
$this->add_control(
'campaign_id',
array(
'label' => esc_html__( 'Select Campaign', 'optin-monster-api' ),
'type' => Controls_Manager::SELECT,
'frontend_available' => true,
'label_block' => true,
'options' => $campaigns,
'default' => '',
)
);
$this->add_control(
'followrules',
array(
'label' => esc_html__( 'Use Output Settings', 'optin-monster-api' ),
'type' => Controls_Manager::SWITCHER,
'frontend_available' => true,
'label_on' => esc_html__( 'Yes', 'optin-monster-api' ),
'label_off' => esc_html__( 'No', 'optin-monster-api' ),
'return_value' => 'yes',
'condition' => array(
'campaign_id!' => '0',
),
)
);
$this->add_control(
'edit_campaign',
array(
'show_label' => false,
'type' => Controls_Manager::RAW_HTML,
'raw' => sprintf(
wp_kses(
/* translators: %s - OptinMonster edit link. */
__( 'Need to make changes? <a href="%1s" class="skip-om-trigger" target="_blank" rel="noopener">Edit the selected campaign.</a>', 'optin-monster-api' ),
array(
'a' => array(
'href' => array(),
'class' => array(),
'target' => array(),
'rel' => array(),
),
)
),
esc_url( $this->base->blocks->get_data_for_js( 'editUrl' ) )
),
'condition' => array(
'campaign_id!' => '0',
),
)
);
$this->add_control(
'add_campaign_btn',
array(
'show_label' => false,
'label_block' => false,
'type' => Controls_Manager::BUTTON,
'button_type' => 'default',
'separator' => 'before',
'text' => '<b>+</b>' . esc_html__( 'Create New Inline Campaign', 'optin-monster-api' ),
'event' => 'elementorOMAPIAddInlineBtnClick',
)
);
}
/**
* Render widget output.
*
* @see https://code.elementor.com/methods/elementor-element_base-render/
*
* @since 2.2.0
*/
protected function render() {
if ( Plugin::instance()->editor->is_edit_mode() ) {
$this->render_edit_mode();
} else {
$this->render_frontend();
}
}
/**
* Get the editing-block render format.
*
* @since 2.2.0
*
* @return string Format html string.
*/
protected function get_render_format() {
return '
<div class="om-elementor-editor" data-slug="%1$s">
%2$s
<div class="om-elementor-holder">
%3$s
</div>
<div class="om-errors" style="display:none;">
<strong>' . esc_html__( 'OptinMonster Campaign Error:', 'optin-monster-api' ) . '</strong><br><span class="om-error-description"></span>
</div>
</div>
';
}
/**
* Get the campaign-selector html.
*
* @since 2.2.0
*
* @param bool $icon Whether to include Archie icon.
*
* @return string Html string.
*/
protected function get_campaign_select_html( $icon = true ) {
$data = $this->base->blocks->get_data_for_js();
if ( ! $this->base->blocks->has_sites() ) {
$guts = '
<div class="om-elementor-editor-no_sites">
' . ( $icon ? '<img src="' . $this->base->url . 'assets/css/images/icons/archie-color-icon.svg">' : '' ) . '
<p class="om-elementor-editor-no_sites-help">
<strong>' . esc_html__( 'You Have Not Connected to OptinMonster', 'optin-monster-api' ) . '</strong>
<br>
' . esc_html__( 'Please create a Free Account or Connect an Existing Account', 'optin-monster-api' ) . '
</p>
<p class="om-elementor-editor-no_sites-button">
<a class="om-help-button skip-om-trigger components-button is-primary" href="' . $data['wizardUri'] . '" target="_blank" rel="noopener">
' . $data['i18n']['no_sites_button_create_account'] . '
</a>
<span>or</span>
<a class="om-help-button skip-om-trigger components-button is-secondary" href="' . $data['settingsUri'] . '" target="_blank" rel="noopener">
' . $data['i18n']['no_sites_button_connect_account'] . '
</a>
</p>
</div>
';
} elseif ( ! $this->has_inline_campaigns() ) {
$guts = '
<div class="om-elementor-editor-no_campaigns">
' . ( $icon ? '<img src="' . $this->base->url . 'assets/css/images/icons/archie-color-icon.svg">' : '' ) . '
<p class="om-elementor-editor-no_campaigns-help">
<strong>' . $data['i18n']['no_campaigns'] . '</strong>
<br>
' . $data['i18n']['no_campaigns_help'] . '
</p>
<p class="om-elementor-editor-no_campaigns-button">
<a class="om-help-button skip-om-trigger components-button om-green omapi-link-arrow-after" href="' . $data['templatesUri'] . '&type=inline" target="_blank" rel="noopener">
' . $data['i18n']['create_inline_campaign'] . '
</a>
</p>
<p class="om-elementor-editor-no_campaigns-button-help">
<a class="om-help-button skip-om-trigger components-button is-secondary" href="https://optinmonster.com/docs/getting-started-optinmonster-wordpress-checklist/?utm_source=plugin&utm_medium=link&utm_campaign=gutenbergblock" target="_blank" rel="noopener">
' . esc_html__( 'Need some help? Check out our comprehensive guide.', 'optin-monster-api' ) . '
</a>
</p>
</div>
';
} else {
$guts = '
<div class="om-elementor-editor-select-label">
' . ( $icon ? '<img src="' . $this->base->url . 'assets/css/images/icons/archie-icon.svg">' : '' ) . '
OptinMonster
</div>
<p>' . esc_html__( 'Select and display your email marketing form or smart call-to-action campaigns from OptinMonster.', 'optin-monster-api' ) . '</p>
<div class="om-elementor-editor-select-controls">
<select></select>
<div class="om-elementor-editor-select-controls-button">
<a class="om-help-button skip-om-trigger components-button is-secondary" href="' . $data['templatesUri'] . '&type=inline" target="_blank" rel="noopener">
' . esc_html__( 'Create a New Inline Campaign', 'optin-monster-api' ) . '
</a>
<a class="om-help-button skip-om-trigger components-button is-secondary" href="' . $data['templatesUri'] . '&type=popup" target="_blank" rel="noopener">
' . esc_html__( 'Create a New Popup Campaign', 'optin-monster-api' ) . '
</a>
</div>
</div>
';
}
return '<div class="om-elementor-editor-select">' . $guts . '</div>';
}
/**
* Get the campaign holder html.
*
* @since 2.2.0
*
* @param string $campaign_id Campaign Id string.
*
* @return string Html.
*/
public function get_campaign_holder( $campaign_id ) {
return sprintf(
'
<div id="om-%1$s-holder">
<div class="om-elementor-editor-holder-loading om-elementor-editor-select-label">
<img src="' . $this->base->url . 'assets/css/images/icons/archie-icon.svg">
' . esc_html__( 'Loading Campaign...', 'optin-monster-api' ) . '
</div>
</div>
',
$campaign_id
);
}
/**
* Render widget output in edit mode.
*
* @since 2.2.0
*/
protected function render_edit_mode() {
$campaign_id = esc_attr( $this->get_settings_for_display( 'campaign_id' ) );
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
printf(
$this->get_render_format(),
$campaign_id,
! $campaign_id ? $this->get_campaign_select_html() : '',
$campaign_id ? $this->get_campaign_holder( $campaign_id ) : ''
);
// phpcs:enable
}
/**
* This method is used by the parent methods to output the backbone/underscore template.
*
* @see https://code.elementor.com/methods/elementor-element_base-_content_template/
*
* @since 2.2.0
*/
protected function content_template() {
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
printf(
$this->get_render_format(),
'{{{ settings.campaign_id.replace(/[^a-zA-Z0-9]/g, "") }}}',
'<# if ( ! settings.campaign_id ) { #>' . $this->get_campaign_select_html() . '<# } #>',
'<# if ( settings.campaign_id ) { #>' . $this->get_campaign_holder( '{{{ settings.campaign_id.replace(/[^a-zA-Z0-9]/g, "") }}}' ) . '<# } #>'
);
// phpcs:enable
}
/**
* Render widget output on the frontend.
*
* @since 2.2.0
*/
protected function render_frontend() {
echo do_shortcode( $this->get_shortcode_output() );
}
/**
* Render widget as plain content.
*
* @see https://code.elementor.com/methods/elementor-widget_base-render_plain_content/
*
* @since 2.2.0
*/
public function render_plain_content() {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->get_shortcode_output();
}
/**
* Render shortcode.
*
* @since 2.2.0
*
* @return string Shortcode
*/
protected function get_shortcode_output() {
return sprintf(
'[optin-monster slug="%1$s"%2$s]',
esc_attr( $this->get_settings_for_display( 'campaign_id' ) ),
$this->get_settings_for_display( 'followrules' ) === 'yes' ? ' followrules="true"' : ''
);
}
/**
* Does the user have any inline campaigns created?
*
* @since 2.2.0
*
* @return boolean
*/
protected function has_inline_campaigns() {
$campaigns = $this->base->blocks->get_campaign_options();
return ! empty( $campaigns['inline'] );
}
}
var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/optinmonster/OMAPI/Widget.php 0000644 00000014774 15154203623 0026052 0 ustar 00 <?php
/**
* Widget class.
*
* @since 1.0.0
*
* @package OMAPI
* @author Thomas Griffin
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Widget class.
*
* @since 1.0.0
*/
class OMAPI_Widget extends WP_Widget {
/**
* Holds the class object.
*
* @since 1.0.0
*
* @var object
*/
public static $instance;
/**
* Path to the file.
*
* @since 1.0.0
*
* @var string
*/
public $file = __FILE__;
/**
* Holds the base class object.
*
* @since 1.0.0
*
* @var object
*/
public $base;
/**
* Constructor. Sets up and creates the widget with appropriate settings.
*
* @since 1.0.0
*/
public function __construct() {
// Load the base class object.
$this->base = OMAPI::get_instance();
$widget_ops = apply_filters(
'optin_monster_api_widget_ops',
array(
'classname' => 'optin-monster-api',
'description' => esc_html__( 'Place an OptinMonster campaign into a widgetized area.', 'optin-monster-api' ),
)
);
$control_ops = apply_filters(
'optin_monster_api_widget_control_ops',
array(
'id_base' => 'optin-monster-api',
'height' => 350,
'width' => 225,
)
);
parent::__construct(
'optin-monster-api',
apply_filters( 'optin_monster_api_widget_name', esc_html__( 'OptinMonster', 'optin-monster-api' ) ),
$widget_ops,
$control_ops
);
}
/**
* Outputs the widget within the widgetized area.
*
* @since 1.0.0
*
* @param array $args The default widget arguments.
* @param array $instance The input settings for the current widget instance.
*
* @return void
*/
public function widget( $args, $instance ) {
$title = apply_filters( 'widget_title', isset( $instance['title'] ) ? $instance['title'] : '' );
$optin_id = isset( $instance['optin_monster_id'] ) ? $instance['optin_monster_id'] : 0;
do_action( 'optin_monster_api_widget_before_output', $args, $instance );
echo $args['before_widget'];
do_action( 'optin_monster_api_widget_before_title', $args, $instance );
// If a title exists, output it.
if ( $title ) {
echo $args['before_title'] . $title . $args['after_title'];
}
do_action( 'optin_monster_api_widget_before_optin', $args, $instance );
// If a optin has been selected, output it.
if ( $optin_id ) {
// Grab the optin object. If it does not exist, return early.
$optin = absint( $optin_id ) ? $this->base->get_optin( $optin_id ) : $this->base->get_optin_by_slug( $optin_id );
if ( ! $optin ) {
return;
}
// If in test mode but not logged in, skip over the optin.
$test = (bool) get_post_meta( $optin->ID, '_omapi_test', true );
if ( $test && ! is_user_logged_in() ) {
return;
}
// Load the optin.
optin_monster(
$optin->ID,
'id',
array(
'followrules' => ! empty( $instance['followrules'] ) ? 'true' : 'false',
)
);
}
do_action( 'optin_monster_api_widget_after_optin', $args, $instance );
echo $args['after_widget'];
do_action( 'optin_monster_api_widget_after_output', $args, $instance );
}
/**
* Sanitizes and updates the widget.
*
* @since 1.0.0
*
* @param array $new_instance The new input settings for the current widget instance.
* @param array $old_instance The old input settings for the current widget instance.
*
* @return array
*/
public function update( $new_instance, $old_instance ) {
// Set $instance to the old instance in case no new settings have been updated for a particular field.
$instance = $old_instance;
// Sanitize user inputs.
$instance['title'] = trim( $new_instance['title'] );
$instance['followrules'] = ! empty( $new_instance['followrules'] );
$instance['optin_monster_id'] = absint( $new_instance['optin_monster_id'] );
return apply_filters( 'optin_monster_api_widget_update_instance', $instance, $new_instance );
}
/**
* Outputs the widget form where the user can specify settings.
*
* @since 1.0.0
*
* @param array $instance The input settings for the current widget instance.
*
* @return void
*/
public function form( $instance ) {
// Get all available optins and widget properties.
$optins = $this->base->get_optins();
$title = isset( $instance['title'] ) ? $instance['title'] : '';
$followrules = ! empty( $instance['followrules'] );
$optin_id = isset( $instance['optin_monster_id'] ) ? $instance['optin_monster_id'] : false;
do_action( 'optin_monster_api_widget_before_form', $instance );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'optin-monster-api' ); ?></label>
<input 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( $title ); ?>" style="width: 100%;" />
</p>
<?php do_action( 'optin_monster_api_widget_middle_form', $instance ); ?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'optin_monster_id' ) ); ?>"><?php esc_html_e( 'Campaign', 'optin-monster-api' ); ?></label>
<select id="<?php echo esc_attr( $this->get_field_id( 'optin_monster_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'optin_monster_id' ) ); ?>" style="width: 100%;">
<?php if ( ! empty( $optins ) ) {
foreach ( $optins as $optin ) {
$type = get_post_meta( $optin->ID, '_omapi_type', true );
$enabled = (bool) get_post_meta( $optin->ID, '_omapi_enabled', true );
// Only allow sidebar types.
if ( 'sidebar' !== $type && 'inline' !== $type ) {
continue;
}
// Display disabled or enabled selection.
if ( $enabled ) {
echo '<option value="' . esc_attr( $optin->ID ) . '"' . selected( $optin->ID, $optin_id, false ) . '>' . esc_html( $optin->post_title ) . '</option>';
} else {
echo '<option value="' . esc_attr( $optin->ID ) . '" disabled="disabled"' . selected( $optin->ID, $optin_id, false ) . '>' . esc_html( $optin->post_title ) . ' (' . esc_html__( 'Not Enabled', 'optin-monster-api' ) . ')</option>';
}
}
}
?>
</select>
</p>
<p>
<input id="<?php echo esc_attr( $this->get_field_id( 'followrules' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'followrules' ) ); ?>" type="checkbox" value="1" <?php checked( $followrules ); ?> />
<label for="<?php echo esc_attr( $this->get_field_id( 'followrules' ) ); ?>"><?php esc_html_e( 'Apply Advanced Output Settings?', 'optin-monster-api' ); ?></label>
</p>
<?php
do_action( 'optin_monster_api_widget_after_form', $instance );
}
}
uyarreklam.com.tr/httpdocs/wp-content/plugins/all-in-one-seo-pack/app/Common/Sitemap/Html/Widget.php0000644 00000013607 15155050104 0032323 0 ustar 00 var/www/vhosts <?php
namespace AIOSEO\Plugin\Common\Sitemap\Html;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Widget.
*
* @since 4.1.3
*/
class Widget extends \WP_Widget {
/**
* The default attributes.
*
* @since 4.2.7
*
* @var array
*/
private $defaults = [];
/**
* Class constructor.
*
* @since 4.1.3
*/
public function __construct() {
// The default widget settings.
$this->defaults = [
'title' => '',
'show_label' => 'on',
'archives' => '',
'nofollow_links' => '',
'order' => 'asc',
'order_by' => 'publish_date',
'publication_date' => 'on',
'post_types' => [ 'post', 'page' ],
'taxonomies' => [ 'category', 'post_tag' ],
'excluded_posts' => '',
'excluded_terms' => ''
];
$widgetSlug = 'aioseo-html-sitemap-widget';
$widgetOptions = [
'classname' => $widgetSlug,
// Translators: The short plugin name ("AIOSEO").
'description' => sprintf( esc_html__( '%1$s HTML sitemap widget.', 'all-in-one-seo-pack' ), AIOSEO_PLUGIN_SHORT_NAME )
];
$controlOptions = [
'id_base' => $widgetSlug
];
// Translators: 1 - The plugin short name ("AIOSEO").
$name = sprintf( esc_html__( '%1$s - HTML Sitemap', 'all-in-one-seo-pack' ), AIOSEO_PLUGIN_SHORT_NAME );
$name .= ' ' . esc_html__( '(legacy)', 'all-in-one-seo-pack' );
parent::__construct( $widgetSlug, $name, $widgetOptions, $controlOptions );
}
/**
* Callback for the widget.
*
* @since 4.1.3
*
* @param array $args The widget arguments.
* @param array $instance The widget instance options.
* @return void
*/
public function widget( $args, $instance ) {
if ( ! aioseo()->options->sitemap->html->enable ) {
return;
}
// Merge with defaults.
$instance = wp_parse_args( (array) $instance, $this->defaults );
echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
if ( ! empty( $instance['title'] ) ) {
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped,Generic.Files.LineLength.MaxExceeded
}
$instance = aioseo()->htmlSitemap->frontend->getAttributes( $instance );
aioseo()->htmlSitemap->frontend->output( true, $instance );
echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Callback to update the widget options.
*
* @since 4.1.3
*
* @param array $newOptions The new options.
* @param array $oldOptions The old options.
* @return array The new options.
*/
public function update( $newOptions, $oldOptions ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$settings = [
'title',
'order',
'order_by',
'show_label',
'publication_date',
'archives',
'excluded_posts',
'excluded_terms'
];
foreach ( $settings as $setting ) {
$newOptions[ $setting ] = ! empty( $newOptions[ $setting ] ) ? wp_strip_all_tags( $newOptions[ $setting ] ) : '';
}
$includedPostTypes = [];
if ( ! empty( $newOptions['post_types'] ) ) {
$postTypes = $this->getPublicPostTypes( true );
foreach ( $newOptions['post_types'] as $v ) {
if ( is_numeric( $v ) ) {
$includedPostTypes[] = $postTypes[ $v ];
} else {
$includedPostTypes[] = $v;
}
}
}
$newOptions['post_types'] = $includedPostTypes;
$includedTaxonomies = [];
if ( ! empty( $newOptions['taxonomies'] ) ) {
$taxonomies = aioseo()->helpers->getPublicTaxonomies( true );
foreach ( $newOptions['taxonomies'] as $v ) {
if ( is_numeric( $v ) ) {
$includedTaxonomies[] = $taxonomies[ $v ];
} else {
$includedTaxonomies[] = $v;
}
}
}
$newOptions['taxonomies'] = $includedTaxonomies;
if ( ! empty( $newOptions['excluded_posts'] ) ) {
$newOptions['excluded_posts'] = $this->sanitizeExcludedIds( $newOptions['excluded_posts'] );
}
if ( ! empty( $newOptions['excluded_terms'] ) ) {
$newOptions['excluded_terms'] = $this->sanitizeExcludedIds( $newOptions['excluded_terms'] );
}
return $newOptions;
}
/**
* Callback for the widgets options form.
*
* @since 4.1.3
*
* @param array $instance The widget options.
* @return void
*/
public function form( $instance ) {
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$instance = wp_parse_args( (array) $instance, $this->defaults );
$postTypeObjects = $this->getPublicPostTypes();
$postTypes = $this->getPublicPostTypes( true );
$taxonomyObjects = aioseo()->helpers->getPublicTaxonomies();
// phpcs:enable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
include AIOSEO_DIR . '/app/Common/Views/sitemap/html/widget-options.php';
}
/**
* Returns the public post types (without attachments).
*
* @since 4.1.3
*
* @param boolean $namesOnly Whether only the names should be returned.
* @return array The public post types.
*/
private function getPublicPostTypes( $namesOnly = false ) {
$postTypes = aioseo()->helpers->getPublicPostTypes( $namesOnly );
foreach ( $postTypes as $k => $postType ) {
if ( is_array( $postType ) && 'attachment' === $postType['name'] ) {
unset( $postTypes[ $k ] );
break;
}
if ( ! is_array( $postType ) && 'attachment' === $postType ) {
unset( $postTypes[ $k ] );
break;
}
}
return array_values( $postTypes );
}
/**
* Sanitizes the excluded IDs by removing any non-integer values.
*
* @since 4.1.3
*
* @param string $ids The IDs as a string, comma-separated.
* @return string The sanitized IDs as a string, comma-separated.
*/
private function sanitizeExcludedIds( $ids ) {
$ids = array_map( 'trim', explode( ',', $ids ) );
$ids = array_filter( $ids, 'is_numeric' );
$ids = esc_sql( implode( ', ', $ids ) );
return $ids;
}
} uyarreklam.com.tr/httpdocs/wp-content/plugins/all-in-one-seo-pack/app/Common/Breadcrumbs/Widget.php 0000644 00000006410 15155130400 0032236 0 ustar 00 var/www/vhosts <?php
namespace AIOSEO\Plugin\Common\Breadcrumbs;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Widget.
*
* @since 4.1.1
*/
class Widget extends \WP_Widget {
/**
* The default attributes.
*
* @since 4.2.7
*
* @var array
*/
private $defaults = [];
/**
* Class constructor.
*
* @since 4.1.1
*/
public function __construct() {
// Widget defaults.
$this->defaults = [
'title' => ''
];
// Widget Slug.
$widgetSlug = 'aioseo-breadcrumb-widget';
// Widget basics.
$widgetOps = [
'classname' => $widgetSlug,
'description' => esc_html__( 'Display the current page breadcrumb.', 'all-in-one-seo-pack' ),
];
// Widget controls.
$controlOps = [
'id_base' => $widgetSlug,
];
// Translators: 1 - The plugin short name ("AIOSEO").
$name = sprintf( esc_html__( '%1$s - Breadcrumbs', 'all-in-one-seo-pack' ), AIOSEO_PLUGIN_SHORT_NAME );
$name .= ' ' . esc_html__( '(legacy)', 'all-in-one-seo-pack' );
parent::__construct( $widgetSlug, $name, $widgetOps, $controlOps );
}
/**
* Widget callback.
*
* @since 4.1.1
*
* @param array $args Widget args.
* @param array $instance The widget instance options.
* @return void
*/
public function widget( $args, $instance ) {
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
// Merge with defaults.
$instance = wp_parse_args( (array) $instance, $this->defaults );
echo $args['before_widget'];
// Title.
if ( ! empty( $instance['title'] ) ) {
echo $args['before_title'];
echo apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
echo $args['after_title'];
}
// If not being previewed in the Customizer maybe show the dummy preview.
if (
! is_customize_preview() &&
(
false !== strpos( wp_get_referer(), admin_url( 'widgets.php' ) ) ||
false !== strpos( wp_get_referer(), admin_url( 'customize.php' ) )
)
) {
aioseo()->breadcrumbs->frontend->preview();
} else {
aioseo()->breadcrumbs->frontend->display();
}
echo $args['after_widget'];
// phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Widget option update.
*
* @since 4.1.1
*
* @param array $newInstance New instance options.
* @param array $oldInstance Old instance options.
* @return array Processed new instance options.
*/
public function update( $newInstance, $oldInstance ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$newInstance['title'] = wp_strip_all_tags( $newInstance['title'] );
return $newInstance;
}
/**
* Widget options form.
*
* @since 4.1.1
*
* @param array $instance The widget instance options.
* @return void
*/
public function form( $instance ) {
// Merge with defaults.
$instance = wp_parse_args( (array) $instance, $this->defaults );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
<?php echo esc_html( __( 'Title:', 'all-in-one-seo-pack' ) ); ?>
</label>
<input
type="text"
id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
value="<?php echo esc_attr( $instance['title'] ); ?>"
class="widefat"
/>
</p>
<?php
}
}