Plugin Directory

Changeset 2930146


Ignore:
Timestamp:
06/23/2023 01:47:42 PM (3 years ago)
Author:
call_from_web
Message:

Release V4

Location:
call-from-web
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • call-from-web/trunk/call-from-web.php

    r2928902 r2930146  
    1 <?php
    2 /*
    3  * Plugin Name: Call From Web
    4  * Plugin URI: https://www.call-from-web.com/plugins/wordpress
    5  * Description: Let your visitors call you by phone for free.
    6  * Version: 3.1
    7  * Author: Call-From-Web.com
    8  * Author URI: https://www.call-from-web.com
    9  * License: GPL2
    10  * */
    11 ?>
    121<?php
    132
    14 define('CFW_APP_URL', 'https://app.call-from-web.com');
    15 define('CFW_ASSET_URL', 'https://js.call-from-web.com');
     3/**
     4 * The plugin bootstrap file
     5 *
     6 * This file is read by WordPress to generate the plugin information in the plugin
     7 * admin area. This file also includes all of the dependencies used by the plugin,
     8 * registers the activation and deactivation functions, and defines a function
     9 * that starts the plugin.
     10 *
     11 * @link              https://www.call-from-web.com/
     12 * @since             4.0.0
     13 * @package           Call_From_Web
     14 *
     15 * @wordpress-plugin
     16 * Plugin Name:       Call From Web
     17 * Plugin URI:        https://www.call-from-web.com
     18 * Description:       Let your visitors call you by phone for free.
     19 * Version:           4.0.0
     20 * Author:            Call-From-Web.com
     21 * Author URI:        https://www.call-from-web.com/
     22 * License:           GPL-2.0+
     23 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     24 * Text Domain:       call-from-web
     25 * Domain Path:       /languages
     26 */
    1627
    17 add_action('admin_menu', 'cfw_add_page_fn');
    18 // Add sub page to the Settings Menu
    19 function cfw_add_page_fn() {
    20   add_options_page('Call From Web', 'Call From Web', 'administrator', __FILE__, 'cfw_options_page_fn');
     28// If this file is called directly, abort.
     29if ( ! defined( 'WPINC' ) ) {
     30  die;
    2131}
    2232
    23 function cfw_options_page_fn() {
    24 ?>
    25   <div class="wrap">
    26     <div class="icon32" id="icon-options-general"><br></div>
    27     <h2>Call From Web</h2>
    28     Set up your domain widget ID here to be able to view your comments. <h3>Need a valid widget ID? <a href="<?= CFW_APP_URL ?>/users/sign_up?utm_source=wordpress&utm_medium=plugin&utm_campaign=settings">Sign up</a>.</h3>
    29     <form action="options.php" method="post">
    30     <?php settings_fields('cfw_plugin_options'); ?>
    31     <?php do_settings_sections(__FILE__); ?>
    32     <p class="submit">
    33       <input name="Submit" type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes'); ?>" />
    34     </p>
    35     <h3><a href="<?= CFW_APP_URL ?>/contact_attempts?utm_source=wordpress&utm_medium=plugin&utm_campaign=settings">Log in</a> to check for incoming calls.</h3>
    36     </form>
    37   </div>
    38 <?php
     33/**
     34 * Currently plugin version.
     35 * Start at version 4.0.0 and use SemVer - https://semver.org
     36 * Rename this for your plugin and update it as you release new versions.
     37 */
     38define( 'CALL_FROM_WEB_VERSION', '4.0.0' );
     39
     40/**
     41 * The code that runs during plugin activation.
     42 * This action is documented in includes/class-call-from-web-activator.php
     43 */
     44function activate_call_from_web() {
     45  require_once plugin_dir_path( __FILE__ ) . 'includes/class-call-from-web-activator.php';
     46  Call_From_Web_Activator::activate();
    3947}
    4048
    41 add_action('admin_init', 'cfw_options_init_fn' );
    42 // Register our settings. Add the settings section, and settings fields
    43 function cfw_options_init_fn(){
    44   register_setting('cfw_plugin_options', 'cfw_plugin_options', 'cfw_plugin_options_validate' );
    45   add_settings_section('cfw_main_section', 'Button Settings', 'cfw_section_text_fn', __FILE__);
    46   add_settings_field('cfw_profile', 'Widget ID', 'cfw_setting_profile', __FILE__, 'cfw_main_section');
    47   add_settings_field('cfw_button_title', 'Button Title', 'cfw_setting_button_title', __FILE__, 'cfw_main_section');
     49/**
     50 * The code that runs during plugin deactivation.
     51 * This action is documented in includes/class-call-from-web-deactivator.php
     52 */
     53function deactivate_call_from_web() {
     54  require_once plugin_dir_path( __FILE__ ) . 'includes/class-call-from-web-deactivator.php';
     55  Call_From_Web_Deactivator::deactivate();
    4856}
    4957
    50 function cfw_section_text_fn(){}
     58register_activation_hook( __FILE__, 'activate_call_from_web' );
     59register_deactivation_hook( __FILE__, 'deactivate_call_from_web' );
    5160
    52 function cfw_setting_profile() {
    53   $options = get_option('cfw_plugin_options');
    54   echo "<input id='plugin_text_string' name='cfw_plugin_options[cfw_profile]' size='40' type='text' value='{$options['cfw_profile']}' />";
     61/**
     62 * The core plugin class that is used to define internationalization,
     63 * admin-specific hooks, and public-facing site hooks.
     64 */
     65require plugin_dir_path( __FILE__ ) . 'includes/class-call-from-web.php';
     66
     67/**
     68 * Begins execution of the plugin.
     69 *
     70 * Since everything within the plugin is registered via hooks,
     71 * then kicking off the plugin from this point in the file does
     72 * not affect the page life cycle.
     73 *
     74 * @since    4.0.0
     75 */
     76function run_call_from_web() {
     77
     78  $plugin = new Call_From_Web();
     79  $plugin->run();
     80
    5581}
    56 
    57 function cfw_setting_key() {
    58   $options = get_option('cfw_plugin_options');
    59   echo "<input id='plugin_text_string' name='cfw_plugin_options[cfw_key]' size='40' type='text' value='{$options['cfw_key']}' />";
    60 }
    61 
    62 function cfw_setting_button_title() {
    63   $options = get_option('cfw_plugin_options');
    64   $button_title = empty($options['cfw_button_title']) ? 'Contact Us' : $options['cfw_button_title'];
    65   echo "<input id='plugin_text_string' name='cfw_plugin_options[cfw_button_title]' size='40' type='text' value='{$button_title}' />";
    66 }
    67 
    68 
    69 function cfw_plugin_options_validate($input) {
    70   // Check our textbox option field contains no HTML tags - if so strip them out
    71   $input['text_string'] =  wp_filter_nohtml_kses($input['text_string']);
    72   return $input; // return validated input
    73 }
    74 
    75 
    76 // add meta info
    77 add_action('wp_footer', 'cfw_addButton');
    78 function cfw_addButton(){
    79   $o = get_option('cfw_plugin_options');
    80   $profile = empty($o['cfw_profile']) ? "no_profile" : $o['cfw_profile'];
    81   $button_title = empty($o['cfw_button_title']) ? 'Contact Us' : $o['cfw_button_title'];
    82   echo "<a href=\"" . CFW_APP_URL . "/request/{$profile}\" id=\"call-from-web-button-{$profile}\">{$button_title}</a>";
    83   echo "<script type=\"text/javascript\">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"". CFW_ASSET_URL . "/button/v2/{$profile}.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,'script','call-from-web-v2-js');</script>";
    84 }
    85 
    86 function cfw_no_api_key_provided_admin_notice() {
    87     $CFW_APP_URL = CFW_APP_URL;
    88     $no_api_key_provided =<<<EOS
    89 <p>You have not entered your Widget ID for <b>Call From Web</b> plugin. <a href="options-general.php?page=call-from-web/call-from-web.php">Please enter your Widget ID here</a>.</p>
    90 <p><a href="{$CFW_APP_URL}/users/sign_up?utm_source=wordpress&utm_medium=plugin&utm_campaign=notice">Get your Widget ID if you don't have one here.</a></p>
    91 EOS;
    92     ?>
    93     <div class="error">
    94         <p><?php _e( $no_api_key_provided ); ?></p>
    95     </div>
    96     <?php
    97 }
    98 
    99 $o = get_option('cfw_plugin_options');
    100 if (empty($o['cfw_profile'])) { add_action( 'admin_notices', 'cfw_no_api_key_provided_admin_notice'); }
     82run_call_from_web();
  • call-from-web/trunk/readme.txt

    r2928912 r2930146  
    22Contributors: call_from_web
    33Tags: call, phone, internet call, click2call, support, feedback, form, button, contact form, request, comment, bug report, request features
    4 Requires at least: 3.3
     4Requires at least: 3.0.1
    55Version: 3.1
    66Tested up to: 6.2
Note: See TracChangeset for help on using the changeset viewer.