PluginProbe ʕ •ᴥ•ʔ
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / trunk
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz vtrunk
2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 0.0.8 0.0.9 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.1.0 1.1.1 1.1.2 1.10.0 1.10.1 1.11.0 1.12.0 1.12.1 1.12.2 1.12.3 1.13.0 1.13.1 1.13.2 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.2 2.6.0
sureforms / modules / gutenberg / classes / class-spec-filesystem.php
sureforms / modules / gutenberg / classes Last commit date
class-spec-block-config.php 2 years ago class-spec-block-helper.php 1 year ago class-spec-block-js.php 2 years ago class-spec-block-loader.php 2 years ago class-spec-filesystem.php 2 months ago class-spec-gb-helper.php 11 months ago class-spec-init-blocks.php 5 months ago class-spec-spectra-compatibility.php 5 months ago
class-spec-filesystem.php
112 lines
1 <?php
2 /**
3 * Sureforms Filesystem
4 *
5 * @package Sureforms
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11
12 /**
13 * Class Spec_Filesystem.
14 */
15 class Spec_Filesystem {
16
17 /**
18 * Member Variable
19 *
20 * @var instance
21 */
22 private static $instance;
23
24 /**
25 * Initiator
26 */
27 public static function get_instance() {
28 if ( ! isset( self::$instance ) ) {
29 self::$instance = new self();
30 }
31 return self::$instance;
32 }
33
34 /**
35 * Get an instance of WP_Filesystem.
36 *
37 * @since 0.0.1
38 */
39 public function get_filesystem() {
40
41 global $wp_filesystem;
42
43 if ( ! $wp_filesystem || 'direct' !== $wp_filesystem->method ) {
44 require_once ABSPATH . '/wp-admin/includes/file.php';
45
46 /**
47 * Context for filesystem, default false.
48 *
49 * @see request_filesystem_credentials_context
50 */
51 $context = apply_filters( 'request_filesystem_credentials_context', false );//phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- wordpress hook
52
53 add_filter( 'filesystem_method', [ $this, 'filesystem_method' ] );
54 add_filter( 'request_filesystem_credentials', [ $this, 'request_filesystem_credentials' ] );
55
56 $creds = request_filesystem_credentials( site_url(), '', true, $context, null );
57
58 WP_Filesystem( $creds, $context );
59
60 remove_filter( 'filesystem_method', [ $this, 'filesystem_method' ] );
61 remove_filter( 'request_filesystem_credentials', [ $this, 'request_filesystem_credentials' ] );
62 }
63
64 // Set the permission constants if not already set.
65 if ( ! defined( 'FS_CHMOD_DIR' ) ) {
66 // phpcs:ignore
67 define( 'FS_CHMOD_DIR', 0755 ); // ignore statement added to avoid WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound, it's pre defined constant in bootstrap.php file
68 // phpcs:ignoreEnd
69 }
70 if ( ! defined( 'FS_CHMOD_FILE' ) ) {
71 // phpcs:ignore
72 define( 'FS_CHMOD_FILE', 0644 ); // ignore statement added to avoid WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound, it's pre defined constant in bootstrap.php file
73 // phpcs:ignoreEnd
74 }
75
76 return $wp_filesystem;
77 }
78
79 /**
80 * Method to direct.
81 *
82 * @since 0.0.1
83 */
84 public function filesystem_method() {
85 return 'direct';
86 }
87
88 /**
89 * Sets credentials to true.
90 *
91 * @since 0.0.1
92 */
93 public function request_filesystem_credentials() {
94 return true;
95 }
96 }
97
98 /**
99 * Prepare if class 'Spec_Filesystem' exist.
100 * Kicking this off by calling 'get_instance()' method
101 */
102 Spec_Filesystem::get_instance();
103
104 /**
105 * Filesystem class
106 *
107 * @since 0.0.1
108 */
109 function spec_filesystem() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Shared Spectra/UAG helper; the name is kept identical across products for cross-plugin compatibility.
110 return Spec_Filesystem::get_instance()->get_filesystem();
111 }
112