Uname:Linux webm009.cluster131.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64

403WebShell
403Webshell
Server IP : 146.59.209.152  /  Your IP : 216.73.216.152
Web Server : Apache
System : Linux webm009.cluster131.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User : monpetu ( 144298)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/monpetu/www/ipprint/wp-content/plugins/cartflows/admin-core/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/monpetu/www/ipprint/wp-content/plugins/cartflows/admin-core/api/step-data.php
<?php
/**
 * CartFlows Flow data.
 *
 * @package CartFlows
 */

namespace CartflowsAdmin\AdminCore\Api;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use CartflowsAdmin\AdminCore\Api\ApiBase;
use CartflowsAdmin\AdminCore\Inc\AdminHelper;
use CartflowsAdmin\AdminCore\Inc\StepMeta;

/**
 * Class StepData.
 */
class StepData extends ApiBase {

	/**
	 * Route base.
	 *
	 * @var string
	 */
	protected $rest_base = '/admin/step-data/';

	/**
	 * Instance
	 *
	 * @access private
	 * @var object Class object.
	 * @since 1.0.0
	 */
	private static $instance;

	/**
	 * Initiator
	 *
	 * @since 1.0.0
	 * @return object initialized object of class.
	 */
	public static function get_instance() {
		if ( ! isset( self::$instance ) ) {
			self::$instance = new self();
		}
		return self::$instance;
	}

	/**
	 * Init Hooks.
	 *
	 * @since 1.0.0
	 * @return void
	 */
	public function register_routes() {

		$namespace = $this->get_api_namespace();

		register_rest_route(
			$namespace,
			$this->rest_base . '(?P<id>[\d-]+)',
			array(
				'args'   => array(
					'id' => array(
						'description' => __( 'Step ID.', 'cartflows' ),
						'type'        => 'integer',
					),
				),
				array(
					'methods'             => \WP_REST_Server::READABLE,
					'callback'            => array( $this, 'get_item' ),
					'permission_callback' => array( $this, 'get_item_permissions_check' ),
				),
				'schema' => array( $this, 'get_public_item_schema' ),
			)
		);
	}

	/**
	 * Get step data.
	 *
	 * @param  WP_REST_Request $request Full details about the request.
	 * @return WP_Error|boolean
	 */
	public function get_item( $request ) {

		$step_id = absint( $request->get_param( 'id' ) );

		// Validate the post type to prevent accessing non-step posts.
		if ( CARTFLOWS_STEP_POST_TYPE !== get_post_type( $step_id ) ) {
			return new \WP_Error( 'cartflows_invalid_step', __( 'Invalid step ID.', 'cartflows' ), array( 'status' => 404 ) );
		}

		$meta_options = array();
		$meta_options = AdminHelper::get_step_meta_options( $step_id );

		$step_type         = $meta_options['type'];
		$flow_id_meta      = get_post_meta( $step_id, 'wcf-flow-id', true );
		$flow_id           = is_numeric( $flow_id_meta ) ? absint( $flow_id_meta ) : 0;
		$edit_step         = get_edit_post_link( $step_id, 'edit' );
		$view_step         = get_permalink( $step_id );
		$page_builder_edit = \Cartflows_Helper::get_page_builder_edit_link( $step_id );

		/* Get Settings */
		$settings_data = StepMeta::get_meta_settings( $step_id, $step_type );

		$meta_options['options']['step_post_name'] = get_post_field( 'post_name', $step_id, 'edit' );

		/* Prepare data */
		$data = apply_filters(
			'cartflows_admin_' . $step_type . '_step_data',
			array(
				'id'                => $step_id,
				// Use the raw stored titles to avoid the_title filters (wptexturize) turning dashes into HTML entities.
				'flow_title'        => get_post_field( 'post_title', $flow_id, 'raw' ),
				'title'             => get_post_field( 'post_title', $step_id, 'raw' ),
				'type'              => $step_type,
				'tabs'              => isset( $settings_data['tabs'] ) ? $settings_data['tabs'] : '',
				'settings_data'     => isset( $settings_data['settings'] ) ? $settings_data['settings'] : '',
				'page_settings'     => isset( $settings_data['page_settings'] ) ? $settings_data['page_settings'] : '',
				'design_settings'   => isset( $settings_data['design_settings'] ) ? $settings_data['design_settings'] : '',
				'options'           => isset( $meta_options['options'] ) ? $meta_options['options'] : '',
				'view'              => $view_step,
				'edit'              => $edit_step,
				'page_builder_edit' => $page_builder_edit,
				// phpcs:ignore Squiz.PHP.CommentedOutCode.Found
				// 'slug'           => get_post_field( 'post_name', $step_id, 'edit' ),
			),
			$step_id
		);

		$response = new \WP_REST_Response( $data );
		$response->set_status( 200 );

		return $response;
	}

	/**
	 * Check whether a given request has permission to read notes.
	 *
	 * @param  WP_REST_Request $request Full details about the request.
	 * @return WP_Error|boolean
	 */
	public function get_item_permissions_check( $request ) {

		if ( ! current_user_can( 'cartflows_manage_flows_steps' ) ) {
			return new \WP_Error( 'cartflows_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'cartflows' ), array( 'status' => rest_authorization_required_code() ) );
		}

		return true;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit