*/ class Chart_Builder_Integrations { /** * The ID of this plugin. * * @since 1.0.0 * @access private * @var string $plugin_name The ID of this plugin. */ private $plugin_name; /** * The version of this plugin. * * @since 1.0.0 * @access private * @var string $version The current version of this plugin. */ private $version; private $settings_obj; private $capability; private $blockquote_content; /** * Initialize the class and set its properties. * * @since 1.0.0 * @param string $plugin_name The name of this plugin. * @param string $version The version of this plugin. */ public function __construct($plugin_name, $version){ $this->plugin_name = $plugin_name; $this->version = $version; $this->settings_obj = new Chart_Builder_Settings_DB_Actions($this->plugin_name); // Add an action to load translations properly add_action('wp_loaded', array($this, 'ays_chart_load_translations')); } /** * Load plugin translations. */ public function ays_chart_load_translations() { $settings_url = sprintf( // Translators: %s will be replaced with a link to the settings page. __( "For enabling this option, please go to %s page and fill all options.", 'chart-builder' ), "". __( "this", 'chart-builder' ) ."" ); $blockquote_content = '
'; $this->blockquote_content = $blockquote_content; } // ===== INTEGRATIONS HOOKS ===== public function ays_chart_page_integrations_content( $args ){ if( ! $this->settings_obj->get_permission_for_editing_plugin() ){ $settings_url = esc_html__( "This functionality is disabled.", 'chart-builder' ); $blockquote_content = ''; $this->blockquote_content = $blockquote_content; } $integrations_contents = apply_filters( 'ays_cb_chart_page_integrations_contents', array(), $args ); $integrations = array(); foreach ($integrations_contents as $key => $integrations_content) { $content = ''; $integrations[] = $content; } echo implode('1. '. __("Turn on Your Google Sheet API", 'chart-builder') .' https://console.developers.google.com
2. '. __("Create ", 'chart-builder') .''. __("new Google Oauth client ID credentials (if you do not still have)", 'chart-builder').'
3. '. __("Choose the application type as Web application", 'chart-builder') .'
4. '. __("Add the following link in the Authorized redirect URIs field", 'chart-builder') .'
Redirect url
5. '. __("Click on the Create button", 'chart-builder') .'
6. '. __("Copy the Your Client ID and Your Client Secret from the opened popup and paste them in the corresponding fields.", 'chart-builder') .'
7. '. __("Click on the Connect button to complete authorization", 'chart-builder') .'
' . __("IP Access:", 'chart-builder') . '
'. __("In some cases, your database may block connections from unknown IP addresses. You might need to whitelist your IP in the database settings to allow access.", 'chart-builder') .'
' . __("Database Host:", 'chart-builder') . ' ' . __("Enter the address of your database (e.g., 'localhost', or a host like 'db.example.com').", 'chart-builder') . '
' . __("Database Name:", 'chart-builder') . ' ' . __("Enter the name of the database you want to connect to.", 'chart-builder') . '
' . __("Database User:", 'chart-builder') . ' ' . __("Enter the username for accessing the database.", 'chart-builder') . '
' . __("Database Password:", 'chart-builder') . ' ' . __("Enter the password for your database user. Make sure this is correct.", 'chart-builder') . '
' . __("Database Port (Optional):", 'chart-builder') . ' ' . __("The default MySQL port is '3306'. You can leave this field empty. If your host doesn't specify a port, we'll use the default value.", 'chart-builder') . '
' . __("Test Connection:", 'chart-builder') . ' ' . __("Click on the 'Test Connection' button to verify that the connection is successful.", 'chart-builder') . '
' . __("If the test fails:", 'chart-builder') . ' ' . __("Please recheck your details or verify if your IP address is whitelisted.", 'chart-builder') . '