@@ -13,23 +13,23 @@ discard block |
||
| 13 | 13 | * @return array |
| 14 | 14 | */ |
| 15 | 15 | function get_restricted_post_types() { |
| 16 | - $post_types = array( |
|
| 17 | - 'page', |
|
| 18 | - 'attachment', |
|
| 19 | - 'forum', |
|
| 20 | - 'topic', |
|
| 21 | - 'lesson', |
|
| 22 | - 'quiz', |
|
| 23 | - 'question', |
|
| 24 | - 'reply', |
|
| 25 | - 'popup', |
|
| 26 | - 'sensei_message', |
|
| 27 | - 'envira', |
|
| 28 | - 'soliloquy', |
|
| 29 | - 'certificate_template', |
|
| 30 | - 'certificate', |
|
| 31 | - 'project', |
|
| 32 | - ); |
|
| 16 | + $post_types = array( |
|
| 17 | + 'page', |
|
| 18 | + 'attachment', |
|
| 19 | + 'forum', |
|
| 20 | + 'topic', |
|
| 21 | + 'lesson', |
|
| 22 | + 'quiz', |
|
| 23 | + 'question', |
|
| 24 | + 'reply', |
|
| 25 | + 'popup', |
|
| 26 | + 'sensei_message', |
|
| 27 | + 'envira', |
|
| 28 | + 'soliloquy', |
|
| 29 | + 'certificate_template', |
|
| 30 | + 'certificate', |
|
| 31 | + 'project', |
|
| 32 | + ); |
|
| 33 | 33 | return apply_filters('lsx_sharing_get_restricted_post_types', $post_types); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -39,15 +39,15 @@ discard block |
||
| 39 | 39 | * @return array |
| 40 | 40 | */ |
| 41 | 41 | function get_to_post_types() { |
| 42 | - $post_types = array( |
|
| 43 | - 'accommodation', |
|
| 44 | - 'tour', |
|
| 45 | - 'destination', |
|
| 46 | - 'review', |
|
| 47 | - 'special', |
|
| 48 | - 'vehicle', |
|
| 49 | - 'activity', |
|
| 50 | - ); |
|
| 42 | + $post_types = array( |
|
| 43 | + 'accommodation', |
|
| 44 | + 'tour', |
|
| 45 | + 'destination', |
|
| 46 | + 'review', |
|
| 47 | + 'special', |
|
| 48 | + 'vehicle', |
|
| 49 | + 'activity', |
|
| 50 | + ); |
|
| 51 | 51 | return apply_filters('lsx_sharing_get_to_post_types', $post_types); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | * @return array |
| 58 | 58 | */ |
| 59 | 59 | function get_hp_post_types() { |
| 60 | - $post_types = array( |
|
| 61 | - 'workout', |
|
| 62 | - 'exercise', |
|
| 63 | - 'recipe', |
|
| 64 | - 'meal', |
|
| 65 | - 'tip', |
|
| 66 | - ); |
|
| 60 | + $post_types = array( |
|
| 61 | + 'workout', |
|
| 62 | + 'exercise', |
|
| 63 | + 'recipe', |
|
| 64 | + 'meal', |
|
| 65 | + 'tip', |
|
| 66 | + ); |
|
| 67 | 67 | return apply_filters('lsx_sharing_get_hp_post_types', $post_types); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @return boolean |
| 74 | 74 | */ |
| 75 | 75 | function is_button_disabled( $post_type = '', $service = '' ) { |
| 76 | - $sharing = lsx_sharing(); |
|
| 76 | + $sharing = lsx_sharing(); |
|
| 77 | 77 | $option = false; |
| 78 | 78 | if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display'][ 'sharing_disable_' . $service ]) ) { |
| 79 | 79 | $option = true; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @return boolean |
| 90 | 90 | */ |
| 91 | 91 | function is_pt_disabled( $post_type = '' ) { |
| 92 | - $sharing = lsx_sharing(); |
|
| 92 | + $sharing = lsx_sharing(); |
|
| 93 | 93 | $option = false; |
| 94 | 94 | if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display'][ 'sharing_disable_pt_' . $post_type ]) ) { |
| 95 | 95 | $option = true; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @return boolean |
| 106 | 106 | */ |
| 107 | 107 | function is_disabled() { |
| 108 | - $sharing = lsx_sharing(); |
|
| 108 | + $sharing = lsx_sharing(); |
|
| 109 | 109 | $option = false; |
| 110 | 110 | if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_disable_all']) ) { |
| 111 | 111 | $option = true; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @return string |
| 122 | 122 | */ |
| 123 | 123 | function get_sharing_text( $post_type = '' ) { |
| 124 | - $sharing = lsx_sharing(); |
|
| 124 | + $sharing = lsx_sharing(); |
|
| 125 | 125 | $text = ''; |
| 126 | 126 | if ( false === $sharing->is_new_options && isset($sharing->options['display']) && ! empty($sharing->options['display']['sharing_label_text']) ) { |
| 127 | 127 | $text = $sharing->options['display']['sharing_label_text']; |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * @return object \lsx\sharing\Sharing(); |
| 31 | 31 | */ |
| 32 | 32 | function lsx_sharing() { |
| 33 | - $lsx_sharing = \lsx\sharing\Sharing::get_instance(); |
|
| 33 | + $lsx_sharing = \lsx\sharing\Sharing::get_instance(); |
|
| 34 | 34 | return $lsx_sharing; |
| 35 | 35 | } |
| 36 | 36 | lsx_sharing(); |
@@ -10,185 +10,185 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | class Settings_Theme { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Holds class instance |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * |
|
| 18 | - * @var object \lsx\sharing\classes\admin\Settings_Theme() |
|
| 19 | - */ |
|
| 20 | - protected static $instance = null; |
|
| 13 | + /** |
|
| 14 | + * Holds class instance |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * |
|
| 18 | + * @var object \lsx\sharing\classes\admin\Settings_Theme() |
|
| 19 | + */ |
|
| 20 | + protected static $instance = null; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Will return true if this is the LSX Sharing settings page. |
|
| 24 | - * |
|
| 25 | - * @var array |
|
| 26 | - */ |
|
| 27 | - public $is_options_page = false; |
|
| 22 | + /** |
|
| 23 | + * Will return true if this is the LSX Sharing settings page. |
|
| 24 | + * |
|
| 25 | + * @var array |
|
| 26 | + */ |
|
| 27 | + public $is_options_page = false; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Holds the id and labels for the navigation. |
|
| 31 | - * |
|
| 32 | - * @var array |
|
| 33 | - */ |
|
| 34 | - public $navigation = array(); |
|
| 29 | + /** |
|
| 30 | + * Holds the id and labels for the navigation. |
|
| 31 | + * |
|
| 32 | + * @var array |
|
| 33 | + */ |
|
| 34 | + public $navigation = array(); |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Contructor |
|
| 38 | - */ |
|
| 39 | - public function __construct() { |
|
| 40 | - add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
| 41 | - add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
| 42 | - add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
| 43 | - add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
| 44 | - add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
| 45 | - add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
| 46 | - add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
| 47 | - add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
| 48 | - } |
|
| 36 | + /** |
|
| 37 | + * Contructor |
|
| 38 | + */ |
|
| 39 | + public function __construct() { |
|
| 40 | + add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
| 41 | + add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
| 42 | + add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
| 43 | + add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
| 44 | + add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
| 45 | + add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
| 46 | + add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
| 47 | + add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Return an instance of this class. |
|
| 52 | - * |
|
| 53 | - * @since 1.0.0 |
|
| 54 | - * |
|
| 55 | - * @return object \lsx\sharing\classes\admin\Settings_Theme() A single instance of this class. |
|
| 56 | - */ |
|
| 57 | - public static function get_instance() { |
|
| 58 | - // If the single instance hasn't been set, set it now. |
|
| 59 | - if ( null == self::$instance ) { |
|
| 60 | - self::$instance = new self(); |
|
| 61 | - } |
|
| 62 | - return self::$instance; |
|
| 63 | - } |
|
| 50 | + /** |
|
| 51 | + * Return an instance of this class. |
|
| 52 | + * |
|
| 53 | + * @since 1.0.0 |
|
| 54 | + * |
|
| 55 | + * @return object \lsx\sharing\classes\admin\Settings_Theme() A single instance of this class. |
|
| 56 | + */ |
|
| 57 | + public static function get_instance() { |
|
| 58 | + // If the single instance hasn't been set, set it now. |
|
| 59 | + if ( null == self::$instance ) { |
|
| 60 | + self::$instance = new self(); |
|
| 61 | + } |
|
| 62 | + return self::$instance; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Disable CMB2 styles on front end forms. |
|
| 67 | - * |
|
| 68 | - * @return bool $enabled Whether to enable (enqueue) styles. |
|
| 69 | - */ |
|
| 70 | - public function disable_cmb2_styles( $enabled ) { |
|
| 71 | - if ( is_admin() ) { |
|
| 72 | - $current_screen = get_current_screen(); |
|
| 73 | - if ( is_object( $current_screen ) && 'settings_page_lsx-sharing-settings' === $current_screen->id ) { |
|
| 74 | - $enabled = false; |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - return $enabled; |
|
| 78 | - } |
|
| 65 | + /** |
|
| 66 | + * Disable CMB2 styles on front end forms. |
|
| 67 | + * |
|
| 68 | + * @return bool $enabled Whether to enable (enqueue) styles. |
|
| 69 | + */ |
|
| 70 | + public function disable_cmb2_styles( $enabled ) { |
|
| 71 | + if ( is_admin() ) { |
|
| 72 | + $current_screen = get_current_screen(); |
|
| 73 | + if ( is_object( $current_screen ) && 'settings_page_lsx-sharing-settings' === $current_screen->id ) { |
|
| 74 | + $enabled = false; |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + return $enabled; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Generates the tabbed navigation for the settings page. |
|
| 82 | - * |
|
| 83 | - * @param string $cmb_id |
|
| 84 | - * @param string $object_id |
|
| 85 | - * @param string $object_type |
|
| 86 | - * @param object $cmb2_obj |
|
| 87 | - * @return void |
|
| 88 | - */ |
|
| 89 | - public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
| 90 | - if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) { |
|
| 91 | - $this->navigation = array(); |
|
| 92 | - $this->is_options_page = true; |
|
| 93 | - if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
| 94 | - foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
| 95 | - if ( 'title' === $field['type'] ) { |
|
| 96 | - $this->navigation[ $field_index ] = $field['name']; |
|
| 97 | - } |
|
| 98 | - } |
|
| 99 | - } |
|
| 100 | - $this->output_navigation(); |
|
| 101 | - } |
|
| 102 | - } |
|
| 80 | + /** |
|
| 81 | + * Generates the tabbed navigation for the settings page. |
|
| 82 | + * |
|
| 83 | + * @param string $cmb_id |
|
| 84 | + * @param string $object_id |
|
| 85 | + * @param string $object_type |
|
| 86 | + * @param object $cmb2_obj |
|
| 87 | + * @return void |
|
| 88 | + */ |
|
| 89 | + public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
| 90 | + if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) { |
|
| 91 | + $this->navigation = array(); |
|
| 92 | + $this->is_options_page = true; |
|
| 93 | + if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
| 94 | + foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
| 95 | + if ( 'title' === $field['type'] ) { |
|
| 96 | + $this->navigation[ $field_index ] = $field['name']; |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | + } |
|
| 100 | + $this->output_navigation(); |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Outputs the WP style navigation for the Settings page. |
|
| 106 | - * |
|
| 107 | - * @return void |
|
| 108 | - */ |
|
| 109 | - public function output_navigation() { |
|
| 110 | - if ( ! empty( $this->navigation ) ) { |
|
| 111 | - ?> |
|
| 104 | + /** |
|
| 105 | + * Outputs the WP style navigation for the Settings page. |
|
| 106 | + * |
|
| 107 | + * @return void |
|
| 108 | + */ |
|
| 109 | + public function output_navigation() { |
|
| 110 | + if ( ! empty( $this->navigation ) ) { |
|
| 111 | + ?> |
|
| 112 | 112 | <div class="wp-filter hide-if-no-js"> |
| 113 | 113 | <ul class="filter-links"> |
| 114 | 114 | <?php |
| 115 | - $first_tab = true; |
|
| 116 | - $total = count( $this->navigation ); |
|
| 117 | - $count = 0; |
|
| 118 | - $separator = ' |'; |
|
| 119 | - $selected_tab = ''; |
|
| 120 | - if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
| 121 | - $selected_tab = sanitize_text_field( $_GET['cmb_tab'] ); |
|
| 122 | - $selected_tab = 'settings_' . $selected_tab; |
|
| 123 | - } |
|
| 124 | - foreach ( $this->navigation as $key => $label ) { |
|
| 125 | - $count++; |
|
| 126 | - $current_css = ''; |
|
| 127 | - if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
| 128 | - $first_tab = false; |
|
| 129 | - $current_css = 'current'; |
|
| 130 | - } |
|
| 131 | - if ( $count === $total ) { |
|
| 132 | - $separator = ''; |
|
| 133 | - } |
|
| 134 | - ?> |
|
| 115 | + $first_tab = true; |
|
| 116 | + $total = count( $this->navigation ); |
|
| 117 | + $count = 0; |
|
| 118 | + $separator = ' |'; |
|
| 119 | + $selected_tab = ''; |
|
| 120 | + if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
| 121 | + $selected_tab = sanitize_text_field( $_GET['cmb_tab'] ); |
|
| 122 | + $selected_tab = 'settings_' . $selected_tab; |
|
| 123 | + } |
|
| 124 | + foreach ( $this->navigation as $key => $label ) { |
|
| 125 | + $count++; |
|
| 126 | + $current_css = ''; |
|
| 127 | + if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
| 128 | + $first_tab = false; |
|
| 129 | + $current_css = 'current'; |
|
| 130 | + } |
|
| 131 | + if ( $count === $total ) { |
|
| 132 | + $separator = ''; |
|
| 133 | + } |
|
| 134 | + ?> |
|
| 135 | 135 | <li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li> |
| 136 | 136 | <?php |
| 137 | - } |
|
| 138 | - ?> |
|
| 137 | + } |
|
| 138 | + ?> |
|
| 139 | 139 | </ul> |
| 140 | 140 | </div> |
| 141 | 141 | <?php |
| 142 | - } |
|
| 143 | - } |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * Outputs the opening tab div. |
|
| 147 | - * |
|
| 148 | - * @param object $field CMB2_Field(); |
|
| 149 | - * @return void |
|
| 150 | - */ |
|
| 151 | - public function output_tab_open_div( $field ) { |
|
| 152 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
| 153 | - ?> |
|
| 145 | + /** |
|
| 146 | + * Outputs the opening tab div. |
|
| 147 | + * |
|
| 148 | + * @param object $field CMB2_Field(); |
|
| 149 | + * @return void |
|
| 150 | + */ |
|
| 151 | + public function output_tab_open_div( $field ) { |
|
| 152 | + if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
| 153 | + ?> |
|
| 154 | 154 | <div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden"> |
| 155 | 155 | <?php |
| 156 | - } |
|
| 157 | - } |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - /** |
|
| 160 | - * Outputs the opening closing div. |
|
| 161 | - * |
|
| 162 | - * @param object $field CMB2_Field(); |
|
| 163 | - * @return void |
|
| 164 | - */ |
|
| 165 | - public function output_tab_closing_div( $field ) { |
|
| 166 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
| 167 | - ?> |
|
| 159 | + /** |
|
| 160 | + * Outputs the opening closing div. |
|
| 161 | + * |
|
| 162 | + * @param object $field CMB2_Field(); |
|
| 163 | + * @return void |
|
| 164 | + */ |
|
| 165 | + public function output_tab_closing_div( $field ) { |
|
| 166 | + if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
| 167 | + ?> |
|
| 168 | 168 | </div> |
| 169 | 169 | <?php |
| 170 | - } |
|
| 171 | - } |
|
| 170 | + } |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
| 174 | - return; |
|
| 175 | - } |
|
| 173 | + public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
| 174 | + return; |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
| 178 | - return ''; |
|
| 179 | - } |
|
| 177 | + public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
| 178 | + return ''; |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - /** |
|
| 182 | - * Outputs the Script for the tabbed navigation. |
|
| 183 | - * |
|
| 184 | - * @param string $cmb_id |
|
| 185 | - * @param string $object_id |
|
| 186 | - * @param string $object_type |
|
| 187 | - * @return void |
|
| 188 | - */ |
|
| 189 | - public function navigation_js( $cmb_id, $object_id, $object_type ) { |
|
| 190 | - if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) { |
|
| 191 | - ?> |
|
| 181 | + /** |
|
| 182 | + * Outputs the Script for the tabbed navigation. |
|
| 183 | + * |
|
| 184 | + * @param string $cmb_id |
|
| 185 | + * @param string $object_id |
|
| 186 | + * @param string $object_type |
|
| 187 | + * @return void |
|
| 188 | + */ |
|
| 189 | + public function navigation_js( $cmb_id, $object_id, $object_type ) { |
|
| 190 | + if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) { |
|
| 191 | + ?> |
|
| 192 | 192 | <script> |
| 193 | 193 | var LSX_SHARING_CMB2 = Object.create( null ); |
| 194 | 194 | |
@@ -215,35 +215,35 @@ discard block |
||
| 215 | 215 | } )( jQuery, window, document ); |
| 216 | 216 | </script> |
| 217 | 217 | <?php |
| 218 | - } |
|
| 219 | - } |
|
| 218 | + } |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * This will add the tab selection to the url. |
|
| 223 | - * |
|
| 224 | - * @param string $url |
|
| 225 | - * @return void |
|
| 226 | - */ |
|
| 227 | - public function add_tab_argument( $url ) { |
|
| 228 | - if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
| 229 | - $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
| 230 | - $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
| 231 | - if ( 'single' !== $tab_selection ) { |
|
| 232 | - $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
| 233 | - } else { |
|
| 234 | - $url = remove_query_arg( 'cmb_tab', $url ); |
|
| 235 | - } |
|
| 236 | - } |
|
| 237 | - return $url; |
|
| 238 | - } |
|
| 221 | + /** |
|
| 222 | + * This will add the tab selection to the url. |
|
| 223 | + * |
|
| 224 | + * @param string $url |
|
| 225 | + * @return void |
|
| 226 | + */ |
|
| 227 | + public function add_tab_argument( $url ) { |
|
| 228 | + if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
| 229 | + $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
| 230 | + $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
| 231 | + if ( 'single' !== $tab_selection ) { |
|
| 232 | + $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
| 233 | + } else { |
|
| 234 | + $url = remove_query_arg( 'cmb_tab', $url ); |
|
| 235 | + } |
|
| 236 | + } |
|
| 237 | + return $url; |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | - /** |
|
| 241 | - * The JS function to init the navigation JS. |
|
| 242 | - * |
|
| 243 | - * @return void |
|
| 244 | - */ |
|
| 245 | - public function navigation_js_init() { |
|
| 246 | - ?> |
|
| 240 | + /** |
|
| 241 | + * The JS function to init the navigation JS. |
|
| 242 | + * |
|
| 243 | + * @return void |
|
| 244 | + */ |
|
| 245 | + public function navigation_js_init() { |
|
| 246 | + ?> |
|
| 247 | 247 | /** |
| 248 | 248 | * Start the JS Class |
| 249 | 249 | */ |
@@ -257,18 +257,18 @@ discard block |
||
| 257 | 257 | LSX_SHARING_CMB2.watchNavigation(); |
| 258 | 258 | }; |
| 259 | 259 | <?php |
| 260 | - } |
|
| 261 | - public function navigation_js_add_tab_input() { |
|
| 262 | - ?> |
|
| 260 | + } |
|
| 261 | + public function navigation_js_add_tab_input() { |
|
| 262 | + ?> |
|
| 263 | 263 | LSX_SHARING_CMB2.addTabInput = function( tab = '' ) { |
| 264 | 264 | var counter = 1; |
| 265 | 265 | $( "form.cmb-form" ).append('<input type="hidden" name="cmb_tab" value="' + tab + '" />'); |
| 266 | 266 | } |
| 267 | 267 | <?php |
| 268 | - } |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - public function navigation_js_url_param() { |
|
| 271 | - ?> |
|
| 270 | + public function navigation_js_url_param() { |
|
| 271 | + ?> |
|
| 272 | 272 | LSX_SHARING_CMB2.urlParam = function(name){ |
| 273 | 273 | var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); |
| 274 | 274 | if ( results == null ){ |
@@ -278,14 +278,14 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | <?php |
| 281 | - } |
|
| 282 | - /** |
|
| 283 | - * The JS function to init the watch navigation JS. |
|
| 284 | - * |
|
| 285 | - * @return void |
|
| 286 | - */ |
|
| 287 | - public function navigation_js_watch_navigation() { |
|
| 288 | - ?> |
|
| 281 | + } |
|
| 282 | + /** |
|
| 283 | + * The JS function to init the watch navigation JS. |
|
| 284 | + * |
|
| 285 | + * @return void |
|
| 286 | + */ |
|
| 287 | + public function navigation_js_watch_navigation() { |
|
| 288 | + ?> |
|
| 289 | 289 | LSX_SHARING_CMB2.watchNavigation = function() { |
| 290 | 290 | $( ".wp-filter li a" ).on( 'click', function(event){ |
| 291 | 291 | event.preventDefault(); |
@@ -301,15 +301,15 @@ discard block |
||
| 301 | 301 | }); |
| 302 | 302 | }; |
| 303 | 303 | <?php |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 305 | |
| 306 | - /** |
|
| 307 | - * Preps the navigation for the js functions. |
|
| 308 | - * |
|
| 309 | - * @return void |
|
| 310 | - */ |
|
| 311 | - public function navigation_js_prep_navigation() { |
|
| 312 | - ?> |
|
| 306 | + /** |
|
| 307 | + * Preps the navigation for the js functions. |
|
| 308 | + * |
|
| 309 | + * @return void |
|
| 310 | + */ |
|
| 311 | + public function navigation_js_prep_navigation() { |
|
| 312 | + ?> |
|
| 313 | 313 | LSX_SHARING_CMB2.prepNavigation = function( tab = '' ) { |
| 314 | 314 | var counter = 1; |
| 315 | 315 | $( ".tab.tab-nav" ).each(function(){ |
@@ -323,5 +323,5 @@ discard block |
||
| 323 | 323 | }); |
| 324 | 324 | } |
| 325 | 325 | <?php |
| 326 | - } |
|
| 326 | + } |
|
| 327 | 327 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * Contructor |
| 23 | 23 | */ |
| 24 | 24 | public function __construct() { |
| 25 | - add_action('cmb2_admin_init', array( $this, 'register_settings_page' )); |
|
| 25 | + add_action('cmb2_admin_init', array( $this, 'register_settings_page' )); |
|
| 26 | 26 | add_action('lsx_sharing_settings_page', array( $this, 'configure_general_fields' ), 15, 1); |
| 27 | 27 | add_action('lsx_sharing_settings_page', array( $this, 'configure_archive_fields' ), 15, 1); |
| 28 | 28 | add_action('admin_enqueue_scripts', array( $this, 'assets' )); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @return object \lsx\sharing\classes\admin\Settings() A single instance of this class. |
| 37 | 37 | */ |
| 38 | 38 | public static function get_instance() { |
| 39 | - // If the single instance hasn't been set, set it now. |
|
| 39 | + // If the single instance hasn't been set, set it now. |
|
| 40 | 40 | if ( null == self::$instance ) { |
| 41 | 41 | self::$instance = new self(); |
| 42 | 42 | } |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | 51 | public function register_settings_page() { |
| 52 | - $args = array( |
|
| 53 | - 'id' => 'lsx_sharing_settings', |
|
| 54 | - 'title' => '<h1>' . esc_html__('LSX Sharing Settings', 'lsx-search') . ' <span class="version">' . LSX_SHARING_VER . '</span></h1>', |
|
| 55 | - 'menu_title' => esc_html__('LSX Sharing', 'search'), // Falls back to 'title' (above). |
|
| 56 | - 'object_types' => array( 'options-page' ), |
|
| 57 | - 'option_key' => 'lsx-sharing-settings', // The option key and admin menu page slug. |
|
| 58 | - 'parent_slug' => 'options-general.php', |
|
| 59 | - 'capability' => 'manage_options', // Cap required to view options-page. |
|
| 60 | - ); |
|
| 52 | + $args = array( |
|
| 53 | + 'id' => 'lsx_sharing_settings', |
|
| 54 | + 'title' => '<h1>' . esc_html__('LSX Sharing Settings', 'lsx-search') . ' <span class="version">' . LSX_SHARING_VER . '</span></h1>', |
|
| 55 | + 'menu_title' => esc_html__('LSX Sharing', 'search'), // Falls back to 'title' (above). |
|
| 56 | + 'object_types' => array( 'options-page' ), |
|
| 57 | + 'option_key' => 'lsx-sharing-settings', // The option key and admin menu page slug. |
|
| 58 | + 'parent_slug' => 'options-general.php', |
|
| 59 | + 'capability' => 'manage_options', // Cap required to view options-page. |
|
| 60 | + ); |
|
| 61 | 61 | $cmb = new_cmb2_box($args); |
| 62 | 62 | do_action('lsx_sharing_settings_page', $cmb); |
| 63 | 63 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * Enqueue JS and CSS. |
| 67 | 67 | */ |
| 68 | 68 | public function assets( $hook ) { |
| 69 | - wp_enqueue_style('lsx-sharing-admin', LSX_SHARING_URL . 'assets/css/lsx-sharing-admin.css', array(), LSX_SHARING_VER); |
|
| 69 | + wp_enqueue_style('lsx-sharing-admin', LSX_SHARING_URL . 'assets/css/lsx-sharing-admin.css', array(), LSX_SHARING_VER); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | * @return void |
| 76 | 76 | */ |
| 77 | 77 | public function configure_general_fields( $cmb ) { |
| 78 | - $global_args = array( |
|
| 79 | - 'title' => __('Global', 'lsx-search'), |
|
| 80 | - 'desc' => esc_html__('Control the sharing WordPress post types.', 'lsx-search'), |
|
| 81 | - ); |
|
| 78 | + $global_args = array( |
|
| 79 | + 'title' => __('Global', 'lsx-search'), |
|
| 80 | + 'desc' => esc_html__('Control the sharing WordPress post types.', 'lsx-search'), |
|
| 81 | + ); |
|
| 82 | 82 | $this->get_fields($cmb, 'global', $global_args); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | * @return void |
| 91 | 91 | */ |
| 92 | 92 | public function configure_archive_fields( $cmb ) { |
| 93 | - $archives = array(); |
|
| 93 | + $archives = array(); |
|
| 94 | 94 | $post_type_args = array( |
| 95 | - 'public' => true, |
|
| 95 | + 'public' => true, |
|
| 96 | 96 | ); |
| 97 | 97 | $post_types = get_post_types($post_type_args); |
| 98 | 98 | if ( ! empty($post_types) ) { |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | $page_title |
| 117 | 117 | ); |
| 118 | 118 | $archives[ $post_type_key ] = array( |
| 119 | - 'title' => __('Blog', 'lsx-search'), |
|
| 120 | - 'desc' => $description, |
|
| 119 | + 'title' => __('Blog', 'lsx-search'), |
|
| 120 | + 'desc' => $description, |
|
| 121 | 121 | ); |
| 122 | 122 | break; |
| 123 | 123 | |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | $page_title |
| 137 | 137 | ); |
| 138 | 138 | $archives[ $post_type_key ] = array( |
| 139 | - 'title' => __('Shop', 'lsx-search'), |
|
| 140 | - 'desc' => $description, |
|
| 139 | + 'title' => __('Shop', 'lsx-search'), |
|
| 140 | + 'desc' => $description, |
|
| 141 | 141 | ); |
| 142 | 142 | break; |
| 143 | 143 | |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | ); |
| 157 | 157 | |
| 158 | 158 | $archives[ $post_type_key ] = array( |
| 159 | - 'title' => $temp_post_type->label, |
|
| 160 | - 'desc' => $description, |
|
| 159 | + 'title' => $temp_post_type->label, |
|
| 160 | + 'desc' => $description, |
|
| 161 | 161 | ); |
| 162 | 162 | } |
| 163 | 163 | break; |
@@ -179,70 +179,70 @@ discard block |
||
| 179 | 179 | * @return void |
| 180 | 180 | */ |
| 181 | 181 | public function get_fields( $cmb, $section, $args ) { |
| 182 | - $cmb->add_field( |
|
| 182 | + $cmb->add_field( |
|
| 183 | 183 | array( |
| 184 | - 'id' => 'settings_' . $section . '_sharing', |
|
| 185 | - 'type' => 'title', |
|
| 186 | - 'name' => $args['title'], |
|
| 187 | - 'default' => $args['title'], |
|
| 188 | - 'description' => $args['desc'], |
|
| 184 | + 'id' => 'settings_' . $section . '_sharing', |
|
| 185 | + 'type' => 'title', |
|
| 186 | + 'name' => $args['title'], |
|
| 187 | + 'default' => $args['title'], |
|
| 188 | + 'description' => $args['desc'], |
|
| 189 | 189 | ) |
| 190 | 190 | ); |
| 191 | 191 | if ( 'global' === $section ) { |
| 192 | 192 | $cmb->add_field( |
| 193 | 193 | array( |
| 194 | - 'name' => esc_html__('Disable all', 'lsx-sharing'), |
|
| 195 | - 'id' => $section . '_disable_all', |
|
| 196 | - 'description' => esc_html__('Disable all share buttons on the site', 'lsx-sharing'), |
|
| 197 | - 'type' => 'checkbox', |
|
| 194 | + 'name' => esc_html__('Disable all', 'lsx-sharing'), |
|
| 195 | + 'id' => $section . '_disable_all', |
|
| 196 | + 'description' => esc_html__('Disable all share buttons on the site', 'lsx-sharing'), |
|
| 197 | + 'type' => 'checkbox', |
|
| 198 | 198 | ) |
| 199 | 199 | ); |
| 200 | 200 | } else { |
| 201 | 201 | $cmb->add_field( |
| 202 | 202 | array( |
| 203 | - 'name' => esc_html__('Disable', 'lsx-sharing'), |
|
| 204 | - 'id' => $section . '_disable_pt', |
|
| 205 | - 'description' => esc_html__('Disable the share buttons on this post type', 'lsx-sharing'), |
|
| 206 | - 'type' => 'checkbox', |
|
| 203 | + 'name' => esc_html__('Disable', 'lsx-sharing'), |
|
| 204 | + 'id' => $section . '_disable_pt', |
|
| 205 | + 'description' => esc_html__('Disable the share buttons on this post type', 'lsx-sharing'), |
|
| 206 | + 'type' => 'checkbox', |
|
| 207 | 207 | ) |
| 208 | 208 | ); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | $cmb->add_field( |
| 212 | 212 | array( |
| 213 | - 'name' => esc_html__('Label text', 'lsx-sharing'), |
|
| 214 | - 'id' => $section . '_label_text', |
|
| 215 | - 'description' => esc_html__('A default label for the sharing.', 'lsx-sharing'), |
|
| 216 | - 'type' => 'text', |
|
| 213 | + 'name' => esc_html__('Label text', 'lsx-sharing'), |
|
| 214 | + 'id' => $section . '_label_text', |
|
| 215 | + 'description' => esc_html__('A default label for the sharing.', 'lsx-sharing'), |
|
| 216 | + 'type' => 'text', |
|
| 217 | 217 | ) |
| 218 | 218 | ); |
| 219 | 219 | if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'facebook') ) ) { |
| 220 | 220 | $cmb->add_field( |
| 221 | 221 | array( |
| 222 | - 'name' => esc_html__('Disable Facebook', 'lsx-sharing'), |
|
| 223 | - 'id' => $section . '_disable_facebook', |
|
| 224 | - 'description' => esc_html__('Disable Facebook share button.', 'lsx-sharing'), |
|
| 225 | - 'type' => 'checkbox', |
|
| 222 | + 'name' => esc_html__('Disable Facebook', 'lsx-sharing'), |
|
| 223 | + 'id' => $section . '_disable_facebook', |
|
| 224 | + 'description' => esc_html__('Disable Facebook share button.', 'lsx-sharing'), |
|
| 225 | + 'type' => 'checkbox', |
|
| 226 | 226 | ) |
| 227 | 227 | ); |
| 228 | 228 | } |
| 229 | 229 | if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'twitter') ) ) { |
| 230 | 230 | $cmb->add_field( |
| 231 | 231 | array( |
| 232 | - 'name' => esc_html__('Disable Twitter', 'lsx-sharing'), |
|
| 233 | - 'id' => $section . '_disable_twitter', |
|
| 234 | - 'description' => esc_html__('Disable Twitter share button.', 'lsx-sharing'), |
|
| 235 | - 'type' => 'checkbox', |
|
| 232 | + 'name' => esc_html__('Disable Twitter', 'lsx-sharing'), |
|
| 233 | + 'id' => $section . '_disable_twitter', |
|
| 234 | + 'description' => esc_html__('Disable Twitter share button.', 'lsx-sharing'), |
|
| 235 | + 'type' => 'checkbox', |
|
| 236 | 236 | ) |
| 237 | 237 | ); |
| 238 | 238 | } |
| 239 | 239 | if ( 'global' === $section || ( 'global' !== $section && ! \lsx\sharing\includes\functions\is_button_disabled('global', 'pinterest') ) ) { |
| 240 | 240 | $cmb->add_field( |
| 241 | 241 | array( |
| 242 | - 'name' => esc_html__('Disable Pinterest', 'lsx-sharing'), |
|
| 243 | - 'id' => $section . '_disable_pinterest', |
|
| 244 | - 'description' => esc_html__('Disable Pinterest button.', 'lsx-sharing'), |
|
| 245 | - 'type' => 'checkbox', |
|
| 242 | + 'name' => esc_html__('Disable Pinterest', 'lsx-sharing'), |
|
| 243 | + 'id' => $section . '_disable_pinterest', |
|
| 244 | + 'description' => esc_html__('Disable Pinterest button.', 'lsx-sharing'), |
|
| 245 | + 'type' => 'checkbox', |
|
| 246 | 246 | ) |
| 247 | 247 | ); |
| 248 | 248 | } |
@@ -250,8 +250,8 @@ discard block |
||
| 250 | 250 | do_action('lsx_sharing_settings_section', $cmb, $section); |
| 251 | 251 | $cmb->add_field( |
| 252 | 252 | array( |
| 253 | - 'id' => $section . '_title_closing', |
|
| 254 | - 'type' => 'tab_closing', |
|
| 253 | + 'id' => $section . '_title_closing', |
|
| 254 | + 'type' => 'tab_closing', |
|
| 255 | 255 | ) |
| 256 | 256 | ); |
| 257 | 257 | } |
@@ -14,6 +14,6 @@ |
||
| 14 | 14 | * Constructor. |
| 15 | 15 | */ |
| 16 | 16 | public function __construct() { |
| 17 | - return lsx_sharing(); |
|
| 17 | + return lsx_sharing(); |
|
| 18 | 18 | } |
| 19 | 19 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * Constructor. |
| 51 | 51 | */ |
| 52 | 52 | public function __construct() { |
| 53 | - add_action('init', array( $this, 'set_options' ), 50); |
|
| 53 | + add_action('init', array( $this, 'set_options' ), 50); |
|
| 54 | 54 | $this->load_vendors(); |
| 55 | 55 | $this->load_includes(); |
| 56 | 56 | $this->load_classes(); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @return object \lsx\member_directory\search\Admin() A single instance of this class. |
| 65 | 65 | */ |
| 66 | 66 | public static function get_instance() { |
| 67 | - // If the single instance hasn't been set, set it now. |
|
| 67 | + // If the single instance hasn't been set, set it now. |
|
| 68 | 68 | if ( null === self::$instance ) { |
| 69 | 69 | self::$instance = new self(); |
| 70 | 70 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * Loads the plugin functions. |
| 76 | 76 | */ |
| 77 | 77 | private function load_vendors() { |
| 78 | - // Configure custom fields. |
|
| 78 | + // Configure custom fields. |
|
| 79 | 79 | if ( ! class_exists('CMB2') ) { |
| 80 | 80 | include_once LSX_SHARING_PATH . 'vendor/CMB2/init.php'; |
| 81 | 81 | } |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | * Loads the plugin functions. |
| 85 | 85 | */ |
| 86 | 86 | private function load_includes() { |
| 87 | - include_once LSX_SHARING_PATH . '/includes/functions.php'; |
|
| 87 | + include_once LSX_SHARING_PATH . '/includes/functions.php'; |
|
| 88 | 88 | } |
| 89 | 89 | /** |
| 90 | 90 | * Loads the plugin functions. |
| 91 | 91 | */ |
| 92 | 92 | private function load_classes() { |
| 93 | - include_once LSX_SHARING_PATH . '/classes/class-admin.php'; |
|
| 93 | + include_once LSX_SHARING_PATH . '/classes/class-admin.php'; |
|
| 94 | 94 | global $lsx_sharing_admin; |
| 95 | 95 | $this->admin = \lsx\sharing\classes\Admin::get_instance(); |
| 96 | 96 | $lsx_sharing_admin; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * Set options. |
| 107 | 107 | */ |
| 108 | 108 | public function set_options() { |
| 109 | - if ( function_exists('tour_operator') ) { |
|
| 109 | + if ( function_exists('tour_operator') ) { |
|
| 110 | 110 | $this->options = get_option('_lsx-to_settings', false); |
| 111 | 111 | } else { |
| 112 | 112 | $this->options = get_option('_lsx_settings', false); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * Contructor |
| 23 | 23 | */ |
| 24 | 24 | public function __construct() { |
| 25 | - add_action('wp_enqueue_scripts', array( $this, 'assets' ), 5); |
|
| 25 | + add_action('wp_enqueue_scripts', array( $this, 'assets' ), 5); |
|
| 26 | 26 | add_filter('wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2); |
| 27 | 27 | add_shortcode('lsx_sharing_buttons', array( $this, 'sharing_buttons_shortcode' )); |
| 28 | 28 | // Storefront (storefront_loop_post, storefront_single_post). |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @return object \lsx\sharing\classes\frontend\Output() A single instance of this class. |
| 49 | 49 | */ |
| 50 | 50 | public static function get_instance() { |
| 51 | - // If the single instance hasn't been set, set it now. |
|
| 51 | + // If the single instance hasn't been set, set it now. |
|
| 52 | 52 | if ( null == self::$instance ) { |
| 53 | 53 | self::$instance = new self(); |
| 54 | 54 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * Enques the assets. |
| 60 | 60 | */ |
| 61 | 61 | public function assets() { |
| 62 | - if ( defined('WP_DEBUG') && true === WP_DEBUG ) { |
|
| 62 | + if ( defined('WP_DEBUG') && true === WP_DEBUG ) { |
|
| 63 | 63 | $min = ''; |
| 64 | 64 | } else { |
| 65 | 65 | $min = '.min'; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $params = apply_filters( |
| 82 | 82 | 'lsx_sharing_js_params', array( |
| 83 | - 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 83 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 84 | 84 | ) |
| 85 | 85 | ); |
| 86 | 86 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * Display/return sharing buttons. |
| 96 | 96 | */ |
| 97 | 97 | public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) { |
| 98 | - $sharing_content = ''; |
|
| 98 | + $sharing_content = ''; |
|
| 99 | 99 | |
| 100 | 100 | if ( ( is_preview() || is_admin() ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) { |
| 101 | 101 | return ''; |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | * Sharing buttons shortcode. |
| 160 | 160 | */ |
| 161 | 161 | public function sharing_buttons_shortcode( $atts ) { |
| 162 | - $atts = shortcode_atts( |
|
| 162 | + $atts = shortcode_atts( |
|
| 163 | 163 | array( |
| 164 | - 'buttons' => '', |
|
| 164 | + 'buttons' => '', |
|
| 165 | 165 | ), $atts, 'lsx_sharing_buttons' |
| 166 | 166 | ); |
| 167 | 167 | |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | * Display buttons (template hook). |
| 182 | 182 | */ |
| 183 | 183 | public function sharing_buttons_template() { |
| 184 | - echo wp_kses_post($this->sharing_buttons()); |
|
| 184 | + echo wp_kses_post($this->sharing_buttons()); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
| 188 | 188 | * Allow data params for Bootstrap modal. |
| 189 | 189 | */ |
| 190 | 190 | public function wp_kses_allowed_html( $allowedtags, $context ) { |
| 191 | - $allowedtags['a']['data-toggle'] = true; |
|
| 191 | + $allowedtags['a']['data-toggle'] = true; |
|
| 192 | 192 | $allowedtags['a']['data-link'] = true; |
| 193 | 193 | return $allowedtags; |
| 194 | 194 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @return void |
| 200 | 200 | */ |
| 201 | 201 | public function output_sharing() { |
| 202 | - if ( is_main_query() && is_single() && ! is_singular(array( 'post', 'page', 'product' )) ) { |
|
| 202 | + if ( is_main_query() && is_single() && ! is_singular(array( 'post', 'page', 'product' )) ) { |
|
| 203 | 203 | |
| 204 | 204 | if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_restricted_post_types()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_to_post_types()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_hp_post_types()) ) { |
| 205 | 205 | return ''; |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @return string |
| 222 | 222 | */ |
| 223 | 223 | public function output_event_sharing( $ical_links = '' ) { |
| 224 | - if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) ) { |
|
| 224 | + if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) ) { |
|
| 225 | 225 | return ''; |
| 226 | 226 | } else { |
| 227 | 227 | $ical_links .= $this->sharing_buttons(); |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | * @var array |
| 22 | 22 | */ |
| 23 | 23 | public $services = array( |
| 24 | - 'facebook', |
|
| 25 | - 'twitter', |
|
| 26 | - 'pinterest', |
|
| 24 | + 'facebook', |
|
| 25 | + 'twitter', |
|
| 26 | + 'pinterest', |
|
| 27 | 27 | ); |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * Constructor. |
| 38 | 38 | */ |
| 39 | 39 | public function __construct( $service, $options, $prefix = 'sharing' ) { |
| 40 | - $this->options = $options; |
|
| 40 | + $this->options = $options; |
|
| 41 | 41 | if ( ! in_array($service, $this->services, true) ) { |
| 42 | 42 | return; |
| 43 | 43 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * Get service link to share. |
| 52 | 52 | */ |
| 53 | 53 | public function get_link( $post ) { |
| 54 | - if ( empty($post) ) { |
|
| 54 | + if ( empty($post) ) { |
|
| 55 | 55 | return ''; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * Get Facebook link to share. |
| 71 | 71 | */ |
| 72 | 72 | public function get_link_facebook( $post ) { |
| 73 | - $permalink = get_permalink($post->ID); |
|
| 73 | + $permalink = get_permalink($post->ID); |
|
| 74 | 74 | $permalink = apply_filters('lsx_sharing_facebook_url', $permalink, $post); |
| 75 | 75 | $title = apply_filters('the_title', $post->post_title); |
| 76 | 76 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * Get Twitter link to share. |
| 82 | 82 | */ |
| 83 | 83 | public function get_link_twitter( $post ) { |
| 84 | - $permalink = get_permalink($post->ID); |
|
| 84 | + $permalink = get_permalink($post->ID); |
|
| 85 | 85 | $permalink = apply_filters('lsx_sharing_twitter_url', $permalink, $post); |
| 86 | 86 | $title = apply_filters('the_title', $post->post_title); |
| 87 | 87 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * Get Pinterest link to share. |
| 109 | 109 | */ |
| 110 | 110 | public function get_link_pinterest( $post ) { |
| 111 | - $permalink = get_permalink($post->ID); |
|
| 111 | + $permalink = get_permalink($post->ID); |
|
| 112 | 112 | $permalink = apply_filters('lsx_sharing_pinterest_url', $permalink, $post); |
| 113 | 113 | $title = apply_filters('the_title', $post->post_title); |
| 114 | 114 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * Constructor. |
| 41 | 41 | */ |
| 42 | 42 | public function __construct() { |
| 43 | - $this->load_classes(); |
|
| 43 | + $this->load_classes(); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @return object \lsx\sharing\Admin() A single instance of this class. |
| 52 | 52 | */ |
| 53 | 53 | public static function get_instance() { |
| 54 | - // If the single instance hasn't been set, set it now. |
|
| 54 | + // If the single instance hasn't been set, set it now. |
|
| 55 | 55 | if ( null === self::$instance ) { |
| 56 | 56 | self::$instance = new self(); |
| 57 | 57 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * Loads the plugin functions. |
| 63 | 63 | */ |
| 64 | 64 | private function load_classes() { |
| 65 | - include_once LSX_SHARING_PATH . '/classes/admin/class-settings-theme.php'; |
|
| 65 | + include_once LSX_SHARING_PATH . '/classes/admin/class-settings-theme.php'; |
|
| 66 | 66 | $this->settings_theme = \lsx\sharing\classes\admin\Settings_Theme::get_instance(); |
| 67 | 67 | include_once LSX_SHARING_PATH . '/classes/admin/class-settings.php'; |
| 68 | 68 | $this->settings = \lsx\sharing\classes\admin\Settings::get_instance(); |