JezK
Edit File: general.php
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?> <section class="psfw-settings general" id="psfw-general-section"> <h3>Icon Settings</h3> <table class="widefat wpx-table"> <tr class="alternate" valign="top"> <td class="row-title" scope="row"> <label for="tablecell"> <?php echo esc_attr__('Icons to Display', 'product-share'); ?> </label> </td> <td> <ul id="sortable" style="margin-top: 5px;" class="checklist sortable"> <?php $psfw_selected_labels = Product_Share::get_options()->selected_lables; foreach ( $psfw_selected_labels as $psfw_label_key => $psfw_label){ // Font Awesome Icon Family $psfw_font_type = 'brands'; if( $psfw_label_key == 'envelope' ){ $psfw_font_type = 'solid'; } if ( $psfw_label_key == 'gmail' ) { $psfw_font_type = 'regular'; } /** * `psfw_icon_key` added to change the icon key * * @since 1.2.6 * */ ?> <li id="list_item_<?php echo esc_attr( $psfw_label_key ); ?>" class='ui-state-default'> <label> <input type='hidden' value='<?php echo esc_attr( $psfw_label ); ?>' name='product_share_option[buttons][<?php echo esc_attr( $psfw_label_key ); ?>]'> <span> <i class="fa-<?php echo esc_attr( $psfw_font_type ); ?> fa-<?php echo esc_attr( apply_filters( 'psfw_icon_key', $psfw_label_key ) ); ?>"></i> <?php echo ( $psfw_label_key == 'envelope' ) ? esc_html__('Email', 'product-share') : esc_attr( $psfw_label ); ?> </span> </label> </li> <?php } ?> </ul> <button class="more-icons" type="button"><i class="fas fa-plus"></i> <?php echo esc_attr__('More Icons', 'product-share'); ?></button> <div class="all-icons"> <ul id="base-list" class="sortable-list"> <?php // Getting the default/saved social icons $psfw_labels = Product_Share::get_options()->labels; foreach( product_share()->all_icons() as $psfw_icon_key => $psfw_icon ): // Font Awesome Icon Family $psfw_font_type = 'brands'; if( $psfw_icon_key == 'envelope' ){ $psfw_font_type = 'solid'; } if ( $psfw_icon_key == 'gmail' ) { $psfw_font_type = 'regular'; } /** * `psfw_icon_key` added to change the icon key * * @since 1.2.6 * */ ?> <li id="<?php echo esc_attr( $psfw_icon_key ); ?>"> <label> <input type="checkbox" name="product_share_option[all_buttons][<?php echo esc_attr( $psfw_icon_key ); ?>]" value="<?php echo esc_attr( $psfw_icon ); ?>" <?php checked( in_array( $psfw_icon, $psfw_labels), 1 ); ?> /> <span> <i class="fa-<?php echo esc_attr( $psfw_font_type ); ?> fa-<?php echo esc_attr( apply_filters( 'psfw_icon_key', $psfw_icon_key ) ); ?>"></i> <?php echo esc_attr( $psfw_icon ); ?> </span> </label> </li> <?php endforeach; ?> </ul> </div> </td> </tr> <?php // Icon Appearance WPXtension_Setting_Fields::select( $psfw_options = array( 'tr_class' => '', 'label' => esc_attr__('Icon Appearance', 'product-share'), 'value' => Product_Share::get_options()->icon_appearance, 'name' => 'product_share_option[icon_appearance]', 'option' => apply_filters('psfw_icon_appearance_option', array( 'option_1' => array( 'name' => 'Only Icon', 'value' => 'only_icon', 'need_pro' => false, ), 'option_2' => array( 'name' => 'Only Text', 'value' => 'only_text', 'need_pro' => false, ), 'option_3' => array( 'name' => 'Icon with text', 'value' => 'icon_with_text', 'need_pro' => false, ), )), 'note' => '', 'need_pro' => false, ) ); // Social Button Shape WPXtension_Setting_Fields::select( $psfw_options = array( 'tr_class' => 'alternate', 'label' => esc_attr__('Social Button Shape', 'product-share'), 'value' => Product_Share::get_options()->button_shape, 'name' => 'product_share_option[button_shape]', 'option' => apply_filters('psfw_button_shape_option', array( 'option_1' => array( 'name' => 'Round', 'value' => 'round', 'need_pro' => false, ), 'option_2' => array( 'name' => 'Square', 'value' => 'square', 'need_pro' => false, ), 'option_3' => array( 'name' => 'Rounded Corner', 'value' => 'rounded_corner', 'need_pro' => false, ), 'option_4' => array( 'name' => 'Leaf (Left)', 'value' => 'leaf_left', 'need_pro' => false, ), 'option_5' => array( 'name' => 'Leaf (Right)', 'value' => 'leaf_right', 'need_pro' => false, ), 'option_6' => array( 'name' => 'TV Screen', 'value' => 'tv_screen', 'need_pro' => false, ), )), 'note' => '', 'need_pro' => false, ) ); // Copy to clipboard WPXtension_Setting_Fields::checkbox( $psfw_options = array( 'tr_class' => '', 'label' => esc_attr__('Enable "Copy to Clipboard"', 'product-share'), 'value' => Product_Share::get_options()->copy_to_clipboard, 'name' => 'product_share_option[copy_to_clipboard]', 'default_value' => 'yes', 'checkbox_label' => esc_attr__('Display "Copy to Clipboard" button to copy product link.', 'product-share'), 'note' => esc_attr__('Note: To get it to work, your site should have a secure connection. For Example: https://example.com', 'product-share'), 'need_pro' => false, ) ); // All Icon Button WPXtension_Setting_Fields::checkbox( $psfw_options = array( 'tr_class' => 'alternate', 'label' => esc_attr__('Enable "All Icon" Button', 'product-share'), 'value' => Product_Share::get_options()->all_icon, 'name' => 'product_share_option[nofollow_link]', 'name' => 'product_share_option[all_icon]', 'default_value' => 'yes', 'checkbox_label' => esc_attr__('Display a "plus" button to show a popup/modal containing all the social icons".', 'product-share'), 'need_pro' => false, ) ); // All Icon Close Button WPXtension_Setting_Fields::checkbox( $psfw_options = array( 'tr_class' => '', 'label' => esc_attr__('Enable Popup Dismiss', 'product-share'), 'value' => get_option( 'product_share_option' ) === false ? 'yes' : ( !isset( Product_Share::get_options()->all_icon_close ) ? 'no' : Product_Share::get_options()->all_icon_close ), 'name' => 'product_share_option[all_icon_close]', 'default_value' => 'yes', 'checkbox_label' => esc_attr__('Display a "Close" button on the social icons popup to dismiss.', 'product-share'), 'need_pro' => false, ) ); ?> </table> <h3>General Settings</h3> <table class="widefat wpx-table"> <?php // Where to Display WPXtension_Setting_Fields::select( $psfw_options = array( 'tr_class' => 'alternate', 'label' => esc_attr__('Where to Display', 'product-share'), 'value' => Product_Share::get_options()->display_position, 'name' => 'product_share_option[display_position]', 'option' => apply_filters('psfw_display_position_option', array( 'option_1' => array( 'name' => 'Always show with category name', 'value' => 'with_category', 'need_pro' => false, ), 'option_2' => array( 'name' => 'Display after product tilte', 'value' => 'after_product_title', 'need_pro' => false, ), 'option_3' => array( 'name' => 'Display after product price', 'value' => 'after_product_price', 'need_pro' => false, ), 'option_4' => array( 'name' => 'Hide Icon', 'value' => 'hide_icon', 'need_pro' => false, ), 'option_5' => array( 'name' => 'Display only Shortcode', 'value' => 'display_only_shortcode', 'need_pro' => true, ), )), 'note' => '', 'need_pro' => false, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ) ); // Enable Icon Title WPXtension_Setting_Fields::checkbox( $psfw_options = array( 'tr_class' => '', 'label' => esc_attr__('Enable Icon Title', 'product-share'), 'value' => Product_Share::get_options()->icon_title, 'name' => 'product_share_option[icon_title]', 'default_value' => 'yes', 'checkbox_label' => esc_attr__('Display title before social icons.', 'product-share'), 'note' => '', 'need_pro' => false, ) ); // Enable Nofollow WPXtension_Setting_Fields::checkbox( $psfw_options = array( 'tr_class' => 'alternate new', 'label' => esc_attr__('Enable Nofollow', 'product-share'), 'value' => get_option( 'product_share_option' ) === false ? 'yes' : ( !isset( Product_Share::get_options()->nofollow_link ) ? 'no' : Product_Share::get_options()->nofollow_link ), 'name' => 'product_share_option[nofollow_link]', 'default_value' => 'yes', 'checkbox_label' => esc_attr__('Enable nofollow to avoid endorsing site.', 'product-share'), 'note' => esc_attr__('Note: If eanbled, it will not pass ranking credit.', 'product-share'), 'need_pro' => false, 'tag' => esc_attr__('New', 'product-share'), ), ); // Enable Encode URL WPXtension_Setting_Fields::checkbox( $psfw_options = array( 'tr_class' => '', 'label' => esc_attr__('Enable Encode URL', 'product-share'), 'value' => Product_Share::get_options()->encode_url, 'name' => 'product_share_option[encode_url]', 'default_value' => 'yes', 'checkbox_label' => esc_attr__('Encode the product URL.', 'product-share'), 'note' => esc_attr__('Note: It will not affect `copy to clipboard` feature. Brwosers can\'t read encoded URL.', 'product-share'), 'need_pro' => false, ) ); // Enable Tooltip WPXtension_Setting_Fields::checkbox( $psfw_options = array( 'tr_class' => 'alternate', 'label' => esc_attr__('Enable Tooltip', 'product-share'), 'value' => get_option( 'product_share_option' ) === false ? 'yes' : ( !isset( Product_Share::get_options()->tooltip ) ? 'no' : Product_Share::get_options()->tooltip ), 'name' => 'product_share_option[tooltip]', 'default_value' => 'yes', 'checkbox_label' => esc_attr__('Display tooltip over social icons.', 'product-share'), 'note' => '', 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ), ); // Enable Variation Link WPXtension_Setting_Fields::checkbox( $psfw_options = array( 'tr_class' => '', 'label' => esc_attr__('Enable Variation Link', 'product-share'), 'value' => Product_Share::get_options()->variation_link, 'name' => 'product_share_option[variation_link]', 'default_value' => 'yes', 'checkbox_label' => esc_attr__('Change the product URL to variation URL after selecting all attribute values from the dropdowns.', 'product-share'), 'note' => '', 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ), ); // Product Wrapper Class WPXtension_Setting_Fields::textarea( $psfw_options = array( 'tr_class' => 'alternate', 'label' => esc_attr__('Container Class', 'product-share'), 'ele_class' => '', 'value' => Product_Share::get_options()->container_class, 'name' => 'product_share_option[container_class]', 'note' => __('Give <code>comma (,)</code> after each target classes. <b>Examples:</b> <code>.product.product-type-variable</code>. <br>Target a container to ensure that both `variation_id input` and `social share icons` are inside of it.', 'product-share'), 'note_info' => __('Keep blank, if you don\'t have any issues with variation dropdown(s) base share URL. This field is for fixing variation dropdown(s) base URL changing compatibility issue.', 'product-share'), 'placeholder' => '.product.product-type-variable', 'need_pro' => false, 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ) ); ?> </table> <h3>Floating Social Icons Settings</h3> <table class="widefat wpx-table"> <?php // Enable Floating Icon WPXtension_Setting_Fields::checkbox( $psfw_options = array( 'tr_class' => 'alternate', 'label' => esc_attr__('Enable Floating Icon', 'product-share'), 'value' => Product_Share::get_options()->float_icon, 'name' => 'product_share_option[float_icon]', 'default_value' => 'yes', 'checkbox_label' => esc_attr__('Enable Floating Social Icon on Single Product Page.', 'product-share'), 'note' => '', 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ) ); // Floating Icon Position WPXtension_Setting_Fields::select( $psfw_options = array( 'tr_class' => '', 'label' => esc_attr__('Position', 'product-share'), 'value' => Product_Share::get_options()->float_icon_position, 'name' => 'product_share_option[float_icon_position]', 'option' => apply_filters('psfw_float_icon_position_option', array( 'option_1' => array( 'name' => 'Right Side', 'value' => 'right_side', 'need_pro' => true, ), 'option_2' => array( 'name' => 'Left Side', 'value' => 'left_side', 'need_pro' => true, ), )), 'note' => '', 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ) ); ?> </table> <h3>Shop/Archive Settings</h3> <table class="widefat wpx-table"> <?php // Enable on Shop/Archive WPXtension_Setting_Fields::checkbox( $psfw_options = array( 'tr_class' => 'alternate', 'label' => esc_attr__('Enable on Archive/Shop', 'product-share'), 'value' => get_option( 'product_share_option' ) === false ? 'yes' : ( !isset( Product_Share::get_options()->social_share_archive ) ? 'no' : Product_Share::get_options()->social_share_archive ), 'name' => 'product_share_option[social_share_archive]', 'default_value' => 'yes', 'checkbox_label' => esc_attr__('Enable Social Icon on Archive/Shop page for each Product.', 'product-share'), 'note' => '', 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ) ); // Button Appearance WPXtension_Setting_Fields::select( $psfw_options = array( 'tr_class' => '', 'label' => esc_attr__('Button Appearance', 'product-share'), 'value' => Product_Share::get_options()->archive_button_appearance, 'name' => 'product_share_option[archive_button_appearance]', 'option' => apply_filters('psfw_archive_button_appearance_option', array( 'option_1' => array( 'name' => 'Only Icon', 'value' => 'only_icon', 'need_pro' => true, ), 'option_2' => array( 'name' => 'Only Text', 'value' => 'only_text', 'need_pro' => true, ), 'option_3' => array( 'name' => 'Icon with text', 'value' => 'icon_with_text', 'need_pro' => true, ), )), 'note' => '', 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ) ); // Button Position WPXtension_Setting_Fields::select( $psfw_options = array( 'tr_class' => 'alternate', 'label' => esc_attr__('Position', 'product-share'), 'value' => Product_Share::get_options()->archive_button_position, 'name' => 'product_share_option[archive_button_position]', 'option' => apply_filters('psfw_archive_button_position_option', array( 'option_1' => array( 'name' => 'Top Left', 'value' => 'top_left', 'need_pro' => true, ), 'option_2' => array( 'name' => 'Top Right', 'value' => 'top_right', 'need_pro' => true, ), )), 'note' => '', 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ) ); // Archive button Shape WPXtension_Setting_Fields::select( $psfw_options = array( 'tr_class' => '', 'label' => esc_attr__('Shape', 'product-share'), 'value' => Product_Share::get_options()->archive_button_shape, 'name' => 'product_share_option[archive_button_shape]', 'option' => apply_filters('psfw_archive_button_shape_option', array( 'option_1' => array( 'name' => 'Round', 'value' => 'round', 'need_pro' => true, ), 'option_2' => array( 'name' => 'Square', 'value' => 'square', 'need_pro' => true, ), 'option_3' => array( 'name' => 'Rounded Corner', 'value' => 'rounded_corner', 'need_pro' => true, ), 'option_4' => array( 'name' => 'Leaf (Left)', 'value' => 'leaf_left', 'need_pro' => false, ), 'option_5' => array( 'name' => 'Leaf (Right)', 'value' => 'leaf_right', 'need_pro' => false, ), 'option_6' => array( 'name' => 'TV Screen', 'value' => 'tv_screen', 'need_pro' => false, ), )), 'note' => '', 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ) ); // Button Color WPXtension_Setting_Fields::color( $psfw_options = array( 'tr_class' => 'alternate', 'label' => esc_attr__('Color', 'product-share'), 'value' => Product_Share::get_options()->archive_button_color, 'name' => 'product_share_option[archive_button_color]', 'default_value' => Product_Share::get_options()->archive_button_color, 'note' => '', 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ) ); // Button Background Color WPXtension_Setting_Fields::color( $psfw_options = array( 'tr_class' => '', 'label' => esc_attr__('Background Color', 'product-share'), 'value' => Product_Share::get_options()->archive_button_bg_color, 'name' => 'product_share_option[archive_button_bg_color]', 'default_value' => Product_Share::get_options()->archive_button_bg_color, 'note' => '', 'need_pro' => true, 'pro_exists' => Product_Share::check_plugin_state('product-share-pro'), ) ); ?> </table> </section>