403Webshell
Server IP : 172.67.147.195  /  Your IP : 216.73.216.142
Web Server : Apache/2
System : Linux hosting8537.lvs 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : mienphi ( 1014)
PHP Version : 8.2.14
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/mienphi/public_html/wp-content/plugins/paid-memberships-pro/blocks/src/membership/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mienphi/public_html/wp-content/plugins/paid-memberships-pro/blocks/src/membership/edit.js
/**
 * Retrieves the translation of text.
 *
 * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/
 */
import { __ } from '@wordpress/i18n';

/**
 * WordPress dependencies
 */
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';

/**
 * CSS code for the Membership Excluded block that gets applied to the editor.
 */
import './editor.scss';

/**
 * Internal dependencies
 */
import ContentVisibilityControls from '../component-content-visibility/content-visibility-controls';

/**
 * Render the Content Visibility block in the editor.
 *
 * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit
 *
 * @return {WPElement} Element to render.
 */
export default function Edit(props) {
	// Set up the block.
	const blockProps = useBlockProps({});
	const { attributes: { invert_restrictions, segment, levels, visibilityBlockEnabled }, setAttributes, isSelected } = props;

	// Handle migrations from PMPro < 3.0.
	// If levels is not empty and segment is 'all', we  need to migrate.
	if (levels.length > 0 && segment == 'all') {
		// If '0' is in levels, then restrictions should be inverted.
		if (levels.includes('0')) {
			// If '0' was the only element, then the segment should be 'all'.
			if (levels.length == 1) {
				setAttributes({ invert_restrictions: '1', segment: 'all', levels: [] });
			} else {
				// Otherwise, the segment should be 'specific' and we need to change the levels array to
				// all level IDs that were not previously selected.
				const newLevels = pmpro.all_level_values_and_labels
					.map((level) => level.value + '')
					.filter((levelID) => !levels.includes(levelID));
				setAttributes({ invert_restrictions: '1', segment: 'specific', levels: newLevels });
			}
		} else {
			// If '0' is not in levels, then we do not need to invert subscriptions and just need to change the segment to 'specific'.
			setAttributes({ invert_restrictions: '0', segment: 'specific' });
		}
	}

	// Always set visibilityBlockEnabled to true.
	if ( visibilityBlockEnabled != true ) {
		setAttributes({ visibilityBlockEnabled: true });
	}

	return [
		isSelected && ContentVisibilityControls(props),
		<div className="pmpro-block-require-membership-element" {...blockProps}>
			<InnerBlocks templateLock={false} />
			<span className="pmpro-block-note">
				<span class="dashicon dashicons dashicons-lock"></span>
				{ __( 'This block has content visibility settings.', 'paid-memberships-pro' ) }
			</span>
		</div>,
	];
}

Youez - 2016 - github.com/yon3zu
LinuXploit