Skip to content

Commit

Permalink
Merge branch 'release/1.9.5.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
atwellpub committed Dec 10, 2018
2 parents e91ef8c + 575849b commit 229f46a
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 20 deletions.
26 changes: 17 additions & 9 deletions classes/admin/class.inbound-analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public static function load_range() {

self::$dates = Inbound_Reporting_Templates::prepare_range(self::$range);

/* set correct datetime formats for db */
$start_date = new DateTime(self::$dates['start_date']);
$end_date = new DateTime(self::$dates['end_date']);
self::$dates['start_date'] = $start_date->format('Y-m-d G:i:s');
self::$dates['end_date'] = $end_date->format('Y-m-d G:i:s');

return array('range' => self::$range, 'dates' => self::$dates);
}

Expand Down Expand Up @@ -296,8 +302,8 @@ public static function prepare_column_data($column, $post_id) {
);
$results = Inbound_Events::get_page_views_count_by('page_id', $params);
?>
<a href='<?php echo admin_url('index.php?action=inbound_generate_report&page_id=' . $post->ID . '&class=Inbound_Impressions_Report&range=' . self::$range . '&tb_hide_nav=true&TB_iframe=true&width=1000&height=600'); ?>' class='thickbox inbound-thickbox' title="<?php echo sprintf(__('past %s days', 'inbound-pro'), self::$range); ?>">
<?php $results; ?>
<a href='<?php echo admin_url('index.php?action=inbound_generate_report&page_id=' . $post->ID . '&class=Inbound_Impressions_Report&range=' . self::$range . '&tb_hide_nav=true&TB_iframe=true&width=1000&height=600'); ?>' class='thickbox inbound-thickbox' title="<?php echo sprintf(__('past %s days', 'inbound-pro'), self::$range); ?>" ">
<?php echo $results; ?>
</a>
<?php
break;
Expand Down Expand Up @@ -359,32 +365,34 @@ public static function process_column_sorting($pieces, $query) {

case 'inbound_impressions':

$pieces['join'] .= " LEFT JOIN {$table_prefix}inbound_page_views ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'";
$pieces['join'] .= " RIGHT JOIN {$table_prefix}inbound_page_views ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'";

$pieces['groupby'] = " {$wpdb->posts}.ID";

$pieces['orderby'] = "COUNT(ee.page_id) $order ";
$pieces['orderby'] = "COUNT(*) $order ";

//print_r($pieces);exit;

break;

case 'inbound_visitors':

$pieces['join'] .= " LEFT JOIN (select lead_id, page_id from {$table_prefix}inbound_page_views group by lead_id) ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'";
$pieces['join'] .= " RIGHT JOIN (select lead_id, page_id from {$table_prefix}inbound_page_views group by lead_id) ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'";

$pieces['groupby'] = " {$wpdb->posts}.ID ";

$pieces['orderby'] = "COUNT(ee.lead_id) $order ";
$pieces['orderby'] = "COUNT(*) $order ";

break;


case 'inbound_actions':

$pieces['join'] .= " LEFT JOIN {$table_prefix}inbound_events ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'";
$pieces['join'] .= " RIGHT JOIN {$table_prefix}inbound_events ee ON ee.page_id = {$wpdb->posts}.ID AND ee.datetime >= '" . self::$dates['start_date'] . "' AND datetime <= '" . self::$dates['end_date'] . "'";

$pieces['groupby'] = " {$wpdb->posts}.ID";

$pieces['orderby'] = "COUNT(ee.page_id) $order ";
$pieces['orderby'] = "COUNT(*) $order ";

break;
}
Expand Down Expand Up @@ -435,4 +443,4 @@ public static function filter_profile_tabs($tabs) {

}

new Inbound_Analytics();
new Inbound_Analytics();
52 changes: 51 additions & 1 deletion classes/admin/class.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,18 @@ public static function extend_settings() {
'value' => null
)
),
array (
'id' => 'page-views-optimize',
'type' => 'html',
'label' => __( 'Database Maintenance' , 'inbound-pro' ),
'description' => __( '' , 'inbound-pro' ),
'callback' => array( 'Inbound_Pro_Settings' , 'display_page_view_db_options'),
'hidden' => false,
'reveal' => array(
'selector' => null ,
'value' => null
)
),
array (
'id' => 'admin-tracking',
'type' => 'radio',
Expand Down Expand Up @@ -793,6 +805,18 @@ public static function display_search() {
<?php
}

public static function display_page_view_db_options() {
?>
<i>TODO/Wishlist:</i>
<ul>
<li>- Auto delete page views older than X days (Keeps DB from growing too large)</li>
<li>- Empty all stats given checkboxes with selectable post types.</li>
<li>- Add 'Older Than' dateselect filter to the above management feature.</li>
<li>- <a href="https://codeable.io/?ref=99TG1">Fund through Codeable.</a></li>
</ul>
<?php
}

/**
* Renders settings given a fields dataset
* @param STRING $fieldgroup_key identification key for which field group to render
Expand Down Expand Up @@ -837,7 +861,33 @@ public static function render_fields( $page ) {

echo '</div>';
}
echo ' </div>';

/* advertisements here */
if ( INBOUND_ACCESS_LEVEL === 0 || INBOUND_ACCESS_LEVEL === 9 ) {
$rand = rand(0,1);
switch ($rand) {
case true:
/* codeable advertisement */
echo ' <div class="inbound-settings-group" style="margin-left:auto;margin-right:auto;text-align:center;">
<h4><b>Sponsored Moment: Want to build on top of Inbound Now? Agents at Codeable are ready to help.</b></h4>
<a href="https://codeable.io/?ref=WwUol">
<img src=\'https://referoo.co/creatives/21/asset.png\' />
</a>
</div>';
echo ' </div>';
break;
case false:
/* WPEngine advertisement here */
echo ' <div class="inbound-settings-group" style="margin-left:auto;margin-right:auto;text-align:center;">
<h4><b>Sponsored Moment: Inbound PRO works great on WPEngine.</b></h4>
<a target="_blank" href="https://shareasale.com/r.cfm?b=1291526&amp;u=1220301&amp;m=41388&amp;urllink=&amp;afftrack="><img src="https://static.shareasale.com/image/41388/SPThemePromoWebBanner728x90V1.png" border="0" /></a>
</div>';
echo ' </div>';
break;
}
}


echo '</div>';
}

Expand Down
6 changes: 3 additions & 3 deletions core/shared/classes/class.database-routines.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static function alter_page_views_table() {
}

if(!isset($col_check->cta_id)) {
$wpdb->get_results("ALTER TABLE {$table_name} ADD `cta_id` VARCHAR(20) NOT NULL");
$wpdb->get_results("ALTER TABLE {$table_name} ADD `cta_id` bigint(20) NOT NULL");
} else {
$wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `cta_id` VARCHAR(20)" );
}
Expand Down Expand Up @@ -267,11 +267,11 @@ public static function alter_events_pageviews_107() {

/* events table */
$table_name = $wpdb->prefix . "inbound_events";
$wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `page_id` VARCHAR(20)" );
$wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `page_id` bigint(20)" );

/* pageviews table */
$table_name = $wpdb->prefix . "inbound_page_views";
$wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `page_id` VARCHAR(20)" );
$wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `page_id` bigint(20)" );
}


Expand Down
8 changes: 4 additions & 4 deletions core/shared/classes/class.events.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ public static function create_page_views_table(){
}

$sql = "CREATE TABLE IF NOT EXISTS $table_name (
`id` bigint(9) NOT NULL AUTO_INCREMENT,
`page_id` varchar(20) NOT NULL,
`cta_id` varchar(20) NOT NULL,
`variation_id` bigint(9) NOT NULL,
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`page_id` bigint(20) NOT NULL,
`cta_id` bigint(20) NOT NULL,
`variation_id` bigint(20) NOT NULL,
`lead_id` bigint(20) NOT NULL,
`lead_uid` varchar(255) NOT NULL,
`list_id` bigint(20) NOT NULL,
Expand Down
6 changes: 3 additions & 3 deletions inbound-pro.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin URI: http://www.inboundnow.com/
Description: Professional Inbound Marketing Suite for WordPress
Author: InboundWP LLC
Version: 1.9.5.1
Version: 1.9.5.5
Author URI: http://www.inboundnow.com/
Text Domain: inbound-pro
*/
Expand Down Expand Up @@ -95,8 +95,8 @@ public function __construct() {
*/
private static function define_constants() {

define('INBOUND_PRO_CURRENT_VERSION', '1.9.5.1' );
define('INBOUND_PRO_STABLE_VERSION', '1.9.4.5' );
define('INBOUND_PRO_CURRENT_VERSION', '1.9.5.5' );
define('INBOUND_PRO_STABLE_VERSION', '1.9.5.1' );
define('INBOUND_PRO_TRANSLATIONS_VERSION', '1.30.22' );
define('INBOUND_PRO_URLPATH', plugin_dir_url( __FILE__ ));
define('INBOUND_PRO_PATH', plugin_dir_path( __FILE__ ) );
Expand Down

0 comments on commit 229f46a

Please sign in to comment.