Skip to content

Commit cfcbeef

Browse files
committed
Class object issue fixed
1 parent 85b41e8 commit cfcbeef

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

codehaveli-bitly-url-shortener.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
define( 'WBITLY_BASENAME', plugin_basename( __FILE__ ) );
2222
define( 'WBITLY_SETTINGS_URL', admin_url( 'tools.php?page=wbitly' ) );
2323

24-
// https://raventools.com/marketing-reports/google-analytics/url-builder/?utm_source=Social%20Network&utm_medium=link&utm_campaign=Bitly&utm_term=Term&utm_content=Content
25-
26-
27-
2824

2925
/**
3026
* Load Admin Assets
@@ -63,4 +59,6 @@
6359
*/
6460

6561

66-
require_once 'inc/wbitly-wp-functions.php';
62+
require_once 'inc/wbitly-wp-functions.php';
63+
64+

inc/wbitly-integration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @Last Modified by: Codehaveli
77
* @Website: www.codehaveli.com
88
* @Email: hello@codehaveli.com
9-
* @Last Modified time: 2020-06-30 19:03:04
9+
* @Last Modified time: 2020-08-27 13:44:51
1010
*/
1111

1212

@@ -22,7 +22,7 @@ function wbitly_generate_shorten_url($permalink){
2222
if ( ! class_exists( 'WbitlyURLSettings' ) ) {
2323
return;
2424
}
25-
global $wbitly_settings;
25+
$wbitly_settings = new WbitlyURLSettings();
2626

2727
$permalink = apply_filters( 'wbitly_url_before_process', $permalink );
2828
$access_token = $wbitly_settings->get_wbitly_access_token();
@@ -122,7 +122,7 @@ function wbitly_shorten_url ($permalink) {
122122

123123

124124

125-
global $wbitly_settings;
125+
$wbitly_settings = new WbitlyURLSettings();
126126

127127
$access_token = $wbitly_settings->get_wbitly_access_token();
128128
$guid = $wbitly_settings->get_wbitly_guid();

inc/wbitly-settings.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
* @Last Modified by: Codehaveli
77
* @Website: www.codehaveli.com
88
* @Email: hello@codehaveli.com
9-
* @Last Modified time: 2020-08-20 09:27:42
9+
* @Last Modified time: 2020-08-27 13:51:35
1010
*/
1111

1212

1313

1414
class WbitlyURLSettings {
15+
1516
private $bitly_url_options;
1617

1718
public function __construct() {
@@ -358,7 +359,7 @@ public function add_wbitly_social_share_button() {
358359

359360
$wbitly_social_share = '';
360361

361-
if($this->bitly_url_options['wbitly_socal_share']){
362+
if(isset($this->bitly_url_options['wbitly_socal_share'])){
362363
$wbitly_social_share = $this->bitly_url_options['wbitly_socal_share'] == "enable" ? "checked" : '';
363364
}
364365

@@ -416,18 +417,15 @@ public function get_wbitly_socal_share_status(){
416417
return $wbitly_socal_share === "enable" ? true : false;
417418
}
418419

420+
}
419421

420422

421423

424+
$wbitly_settings = new WbitlyURLSettings();
422425

423426

424427

425428

426-
}
427-
if ( is_admin() )
428-
$wbitly_settings = new WbitlyURLSettings();
429-
430-
431429

432430

433431

inc/wbitly-util.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @Last Modified by: Codehaveli
77
* @Website: www.codehaveli.com
88
* @Email: hello@codehaveli.com
9-
* @Last Modified time: 2020-06-29 17:26:28
9+
* @Last Modified time: 2020-08-27 13:36:38
1010
*/
1111

1212

@@ -50,8 +50,8 @@ function wbitly_remove_http($url) {
5050

5151
function get_wbitly_headers(){
5252

53-
$bitly_settings = new WbitlyURLSettings();
54-
$access_token = $bitly_settings->get_wbitly_access_token();
53+
$wbitly_settings = new WbitlyURLSettings();
54+
$access_token = $wbitly_settings->get_wbitly_access_token();
5555

5656
$headers = array (
5757
"Host" => "api-ssl.bitly.com",

templates/share.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22

3-
$bitly_url = get_wbitly_short_url($post_id);
3+
global $post_id;
4+
5+
$bitly_url = get_wbitly_short_url($post_id);
46

57
?>
68

0 commit comments

Comments
 (0)