| Server IP : 62.60.133.156 / Your IP : 216.73.217.51 Web Server : LiteSpeed System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64 User : mimradmin ( 1166) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/mimradmin/.trash/wp-content.1/plugins/persian-woocommerce/include/ |
Upload File : |
<?php
defined( 'ABSPATH' ) || exit;
class Persian_Woocommerce_Widget extends Persian_Woocommerce_Core {
public function __construct() {
add_action( 'wp_dashboard_setup', [ $this, 'widget_setup' ] );
}
public function widget_setup() {
wp_add_dashboard_widget( 'persian_woocommerce_feed',
'آخرین اخبار و اطلاعیه های ووکامرس پارسی',
[ $this, 'widget_render' ],
[ $this, 'widget_settings' ] );
}
public function widget_render() { ?>
<div class="rss-widget">
<?php $widget_options = $this->widget_options();
wp_widget_rss_output( [
'url' => 'https://woocommerce.ir/feed/',
'title' => 'آخرین اخبار و اطلاعیه های ووکامرس پارسی',
'meta' => [ 'target' => '_new' ],
'items' => intval( $widget_options['posts_number'] ),
'show_summary' => 1,
'show_author' => 0,
'show_date' => 1,
] );
?>
<div style="border-top: 1px solid #e7e7e7; padding-top: 12px !important; font-size: 12px;">
<img src="<?php echo esc_url( PW()->plugin_url( 'assets/images/feed.png' ) ); ?>" width="16"
height="16">
<a href="http://woosupport.ir" target="_new" title="خانه">وب سایت پشتیبان ووکامرس پارسی</a>
</div>
</div>
<?php
}
public function widget_settings() {
$options = $this->widget_options();
if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['widget_id'] ) && 'persian_woocommerce_feed' == $_POST['widget_id'] ) {
$options['posts_number'] = intval( $_POST['posts_number'] );
update_option( 'persian_woocommerce_feed', $options );
}
?>
<p>
<label for="posts_number">تعداد نوشته های قابل نمایش در ابزارک ووکامرس پارسی:
<select id="posts_number" name="posts_number">
<?php for ( $i = 3; $i <= 20; $i ++ ) {
printf( '<option value="%d" %s>%d</option>', $i, selected( $options['posts_number'], $i, false ), $i );
}
?>
</select>
</label>
</p>
<?php
}
public function widget_options() {
$defaults = [ 'posts_number' => 5 ];
if ( ( ! $options = get_option( 'persian_woocommerce_feed' ) ) || ! is_array( $options ) ) {
$options = [];
}
return array_merge( $defaults, $options );
}
}
new Persian_Woocommerce_Widget();