delete-old-posts-programmatically
/
freemius
/
includes
/
managers
/
class-fs-contact-form-manager.php
class-fs-admin-menu-manager.php
1 year ago
class-fs-admin-notice-manager.php
1 year ago
class-fs-cache-manager.php
5 years ago
class-fs-checkout-manager.php
1 year ago
class-fs-clone-manager.php
11 months ago
class-fs-contact-form-manager.php
1 year ago
class-fs-debug-manager.php
1 year ago
class-fs-gdpr-manager.php
3 years ago
class-fs-key-value-storage.php
3 years ago
class-fs-license-manager.php
5 years ago
class-fs-option-manager.php
3 years ago
class-fs-permission-manager.php
3 years ago
class-fs-plan-manager.php
2 years ago
class-fs-plugin-manager.php
3 years ago
index.php
5 years ago
class-fs-contact-form-manager.php
84 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package Freemius |
| 4 | * @copyright Copyright (c) 2024, Freemius, Inc. |
| 5 | * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 |
| 6 | * @since 2.9.0 |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | class FS_Contact_Form_Manager { |
| 14 | |
| 15 | # region Singleton |
| 16 | |
| 17 | /** |
| 18 | * @var FS_Contact_Form_Manager |
| 19 | */ |
| 20 | private static $_instance; |
| 21 | |
| 22 | /** |
| 23 | * @return FS_Contact_Form_Manager |
| 24 | */ |
| 25 | static function instance() { |
| 26 | if ( ! isset( self::$_instance ) ) { |
| 27 | self::$_instance = new FS_Contact_Form_Manager(); |
| 28 | } |
| 29 | |
| 30 | return self::$_instance; |
| 31 | } |
| 32 | |
| 33 | private function __construct() { |
| 34 | } |
| 35 | |
| 36 | #endregion |
| 37 | |
| 38 | /** |
| 39 | * Retrieves the query params needed to load the Freemius Contact Form in the context of the plugin. |
| 40 | * |
| 41 | * @param Freemius $fs |
| 42 | * |
| 43 | * @return array<string, string> |
| 44 | */ |
| 45 | public function get_query_params( Freemius $fs ) { |
| 46 | $context_params = array( |
| 47 | 'plugin_id' => $fs->get_id(), |
| 48 | 'plugin_public_key' => $fs->get_public_key(), |
| 49 | 'plugin_version' => $fs->get_plugin_version(), |
| 50 | ); |
| 51 | |
| 52 | // Get site context secure params. |
| 53 | if ( $fs->is_registered() ) { |
| 54 | $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params( |
| 55 | $fs->get_site(), |
| 56 | time(), |
| 57 | 'contact' |
| 58 | ) ); |
| 59 | } |
| 60 | |
| 61 | return array_merge( $_GET, array_merge( $context_params, array( |
| 62 | 'plugin_version' => $fs->get_plugin_version(), |
| 63 | 'wp_login_url' => wp_login_url(), |
| 64 | 'site_url' => Freemius::get_unfiltered_site_url(), |
| 65 | // 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons", |
| 66 | ) ) ); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Retrieves the standalone link to the Freemius Contact Form. |
| 71 | * |
| 72 | * @param Freemius $fs |
| 73 | * |
| 74 | * @return string |
| 75 | */ |
| 76 | public function get_standalone_link( Freemius $fs ) { |
| 77 | $query_params = $this->get_query_params( $fs ); |
| 78 | |
| 79 | $query_params['is_standalone'] = 'true'; |
| 80 | $query_params['parent_url'] = admin_url( add_query_arg( null, null ) ); |
| 81 | |
| 82 | return WP_FS__ADDRESS . '/contact/?' . http_build_query( $query_params ); |
| 83 | } |
| 84 | } |