Skip to content

Release #948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/Visualizer/Gutenberg/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function enqueue_gutenberg_scripts() {

$translation_array = array(
'isPro' => $type,
'proTeaser' => Visualizer_Plugin::PRO_TEASER_URL,
'proTeaser' => tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'blockupsell'),
'absurl' => VISUALIZER_ABSURL,
'charts' => Visualizer_Module_Admin::_getChartTypesLocalized(),
'adminPage' => menu_page_url( 'visualizer', false ),
Expand Down
5 changes: 4 additions & 1 deletion classes/Visualizer/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ private function _getCSV( $rows, $filename, $enclose ) {

$bom = chr( 0xEF ) . chr( 0xBB ) . chr( 0xBF );
$fp = tmpfile();
if ( null === $fp ) {
$fp = fopen( wp_tempnam(), 'w+' );
}
if ( ! apply_filters( 'vizualizer_export_include_series_type', true ) ) {
unset( $rows[1] );
$rows = array_values( $rows );
Expand Down Expand Up @@ -624,7 +627,7 @@ protected function get_inline_custom_css( $id, $settings ) {
}

$img_path = VISUALIZER_ABSURL . 'images';
$css .= ".locker,.locker-loader{position:absolute;top:0;left:0;width:100%;height:100%}.locker{z-index:1000;opacity:.8;background-color:#fff;-ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)\";filter:alpha(opacity=80)}.locker-loader{z-index:1001;background:url($img_path/ajax-loader.gif) no-repeat center center}.dt-button{display:none!important}.visualizer-front-container.visualizer-lazy-render{content-visibility: auto;}";
$css .= ".locker,.locker-loader{position:absolute;top:0;left:0;width:100%;height:100%}.locker{z-index:1000;opacity:.8;background-color:#fff;-ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)\";filter:alpha(opacity=80)}.locker-loader{z-index:1001;background:url($img_path/ajax-loader.gif) no-repeat center center}.dt-button{display:none!important}.visualizer-front-container.visualizer-lazy-render{content-visibility: auto;}.google-visualization-controls-categoryfilter label.google-visualization-controls-label {vertical-align: middle;}.google-visualization-controls-categoryfilter li.goog-inline-block {margin: 0 0.2em;}.google-visualization-controls-categoryfilter li {padding: 0 0.2em;}";
$css .= '</style>';

$arguments = array( $css, $settings );
Expand Down
11 changes: 9 additions & 2 deletions classes/Visualizer/Module/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ public function handleGetProSubMenu() {
jQuery( document ).ready( function() {
jQuery( '#toplevel_page_visualizer' ).on( 'click', 'li:not(.wp-submenu-head, .wp-first-item):eq(2)', function( e ) {
e.preventDefault();
window.open( 'https://themeisle.com/plugins/visualizer-charts-and-graphs/upgrade/#pricing', '_blank' );
window.open( '<?php echo tsdk_utmify( 'https://themeisle.com/plugins/visualizer-charts-and-graphs/upgrade/', 'toplevel' ); ?>', '_blank' );
} );
} );
</script>
Expand Down Expand Up @@ -968,6 +968,13 @@ public function renderLibraryPage() {
$settings = $arguments[1];
}

if ( isset( $settings['controls']['ui']['labelStacking'] ) ) {
unset( $settings['controls']['ui']['labelStacking'] );
}
if ( isset( $settings['controls']['ui']['orientation'] ) ) {
unset( $settings['controls']['ui']['orientation'] );
}

// add chart to the array
$charts[ $id ] = array(
'id' => $chart->ID,
Expand Down Expand Up @@ -1086,7 +1093,7 @@ public function getPluginMetaLinks( $plugin_meta, $plugin_file ) {
);
// flattr link
$plugin_meta[] = sprintf(
'<a style="color:red" href="' . Visualizer_Plugin::PRO_TEASER_URL . '" target="_blank">%s</a>',
'<a style="color:red" href="' . tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'pluginrow' ) . '" target="_blank">%s</a>',
esc_html__( 'Pro Addon', 'visualizer' )
);
}
Expand Down
2 changes: 1 addition & 1 deletion classes/Visualizer/Module/Sources.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function addProUpsell( $old, $feature = null ) {
$return .= ' <div class="only-pro-container">';
$return .= ' <div class="only-pro-inner">';
$return .= ' <p>' . $msg . '</p>';
$return .= ' <a target="_blank" href="' . Visualizer_Plugin::PRO_TEASER_URL . '" title="' . __( 'Buy now', 'visualizer' ) . '">' . __( 'Buy now', 'visualizer' ) . '</a>';
$return .= ' <a target="_blank" href="' . tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, esc_attr( $feature ) ) . '" title="' . __( 'Buy now', 'visualizer' ) . '">' . __( 'Buy now', 'visualizer' ) . '</a>';
$return .= ' </div>';
$return .= ' </div>';
$return .= '</div>';
Expand Down
2 changes: 1 addition & 1 deletion classes/Visualizer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Visualizer_Plugin {
const CF_CHART_URL = 'visualizer-chart-url';
const CF_CHART_SCHEDULE = 'visualizer-chart-schedule';
// Added by Ash/Upwork
const PRO_TEASER_URL = 'https://themeisle.com/plugins/visualizer-charts-and-graphs/upgrade/#pricing';
const PRO_TEASER_URL = 'https://themeisle.com/plugins/visualizer-charts-and-graphs/upgrade/';
const PRO_TEASER_TITLE = 'Check PRO version ';

const CF_CHART_CACHE = 'visualizer-chart-cache';
Expand Down
4 changes: 2 additions & 2 deletions classes/Visualizer/Render/Library.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ private function _renderChartBox( $placeholder_id, $chart_id, $with_filter = fal
if ( $this->can_chart_have_action( 'image', $chart_id ) ) {
echo '<a class="visualizer-chart-action visualizer-chart-image" href="javascript:;" title="', esc_attr__( 'Download as image', 'visualizer' ), '" data-chart="visualizer-', $chart_id, '" data-chart-title="', $title, '"></a>';
}
echo '<a class="visualizer-chart-action visualizer-chart-shortcode" href="javascript:;" title="', esc_attr__( 'Click to copy shortcode', 'visualizer' ), '" data-clipboard-text="', esc_attr( $shortcode ), '"></a>';
echo '<a class="visualizer-chart-action visualizer-chart-shortcode" href="javascript:;" title="', esc_attr__( 'Click to copy shortcode', 'visualizer' ), '" data-clipboard-text="', esc_attr( $shortcode ), '"><span class="dashicons dashicons-admin-page"></span></a>';
echo '<span>&nbsp;</span>';
echo '<hr><div class="visualizer-chart-status"><span title="' . __( 'Chart ID', 'visualizer' ) . '">(' . $chart_id . '):</span> <span class="visualizer-date" title="' . __( 'Last Updated', 'visualizer' ) . '">' . $chart_status['date'] . '</span><span class="visualizer-error"><i class="dashicons ' . $chart_status['icon'] . '" data-viz-error="' . esc_attr( str_replace( '"', "'", $chart_status['error'] ) ) . '" title="' . esc_attr( $chart_status['title'] ) . '"></i></span></div>';
echo '</div>';
Expand Down Expand Up @@ -397,7 +397,7 @@ private function _renderSidebar() {
echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Frontend editor', 'visualizer' ) . '</li>';
echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Private charts', 'visualizer' ) . '</li>';
echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Auto-sync with online files', 'visualizer' ) . '</li></ul>';
echo '<p><a href="' . str_replace( '#pricing', '#features', Visualizer_Plugin::PRO_TEASER_URL ) . '" target="_blank" class="button button-primary">' . __( 'View more features', 'visualizer' ) . '</a></p>';
echo '<p><a href="' . tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'sidebarupsell' ) . '" target="_blank" class="button button-primary">' . __( 'View more features', 'visualizer' ) . '</a></p>';
echo '</div>';
echo '</div>';
echo '</div>';
Expand Down
2 changes: 1 addition & 1 deletion classes/Visualizer/Render/Page/Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function _renderContent() {
}
echo '<div class="type-box type-box-', $type, $lib_classes, '">';
if ( ! $array['enabled'] ) {
echo "<a class='pro-upsell' href='" . Visualizer_Plugin::PRO_TEASER_URL . "' target='_blank'>";
echo "<a class='pro-upsell' href='" . tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'charttypes' ) . "' target='_blank'>";
echo "<span class='visualizder-pro-label'>" . __( 'PREMIUM', 'visualizer' ) . '</span>';
}
echo '<label class="type-label', $type === $this->type ? ' type-label-selected' : '', '">';
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}
},
"require-dev": {
"wp-coding-standards/wpcs": "1.2.1",
"wp-coding-standards/wpcs": "^2.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"phpcompatibility/phpcompatibility-wp": "*"
}
Expand Down
45 changes: 24 additions & 21 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 20 additions & 3 deletions css/frame.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,23 @@
}
#control_wrapper_canvas:not(:empty) {
margin: 15px 0 0 5px;
position: relative;
z-index: 1;
}
#control_wrapper_canvas:not(:empty) + #canvas .google-visualization-table {
top: 60px;
}
#control_wrapper_canvas:not(:empty) + #canvas {
top: 55px;
left: 50px;
.vz-vertical .google-visualization-table {
left: 70px;
}
.google-visualization-controls-categoryfilter label.google-visualization-controls-label {
vertical-align: middle;
}
.google-visualization-controls-categoryfilter li.goog-inline-block {
margin: 0 0.2em;
}
.google-visualization-controls-categoryfilter li {
padding: 0 0.2em;
}
.goog-combobox input {
min-height: auto;
Expand Down Expand Up @@ -1526,6 +1539,10 @@ button#viz-text-editor-button {
vertical-align: middle;
}

.viz-simple-editor .viz-html-table {
width: 95%;
}

/******************************************************************************/
/******************************** chartjs ***********************************/
/******************************************************************************/
Expand Down
18 changes: 14 additions & 4 deletions css/library.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,20 @@
}

.visualizer-nochart-shortcode,
.visualizer-chart-shortcode {
background-position: -143px -126px;
.visualizer-nochart-shortcode:focus,
.visualizer-chart-shortcode,
.visualizer-chart-shortcode:focus {
float: left;
background: none;
text-decoration: none;
box-shadow: none;
}
.visualizer-chart-shortcode:hover {
color: #404040;
}
.visualizer-nochart-shortcode .dashicons-admin-page ,
.visualizer-chart-shortcode .dashicons-admin-page {
font-size: 16px;
}

.visualizer-nochart-image,
Expand All @@ -152,8 +163,7 @@
}

.visualizer-chart-shortcode {
padding: 3px 0;
color: #aaa;
color: #404040;
text-shadow: 0 1px 0 #fff;
cursor: pointer;
}
Expand Down
14 changes: 12 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Visualizer: Tables and Charts for WordPress
Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs/
Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
Version: 3.8.0
Author: Themeisle
Expand Down Expand Up @@ -69,6 +69,7 @@ function visualizer_launch() {
define( 'VISUALIZER_BASENAME', plugin_basename( __FILE__ ) );
define( 'VISUALIZER_ABSURL', plugins_url( '/', __FILE__ ) );
define( 'VISUALIZER_ABSPATH', dirname( __FILE__ ) );
define( 'VISUALIZER_DIRNAME', basename( VISUALIZER_ABSPATH ) );
define( 'VISUALIZER_REST_VERSION', 1 );
// if the below is true, then the js/customization.js in the plugin folder will be used instead of the one in the uploads folder (if it exists).
// this is also used in Block.php
Expand Down Expand Up @@ -132,7 +133,16 @@ function visualizer_launch() {
}
add_filter( 'themeisle_sdk_products', 'visualizer_register_sdk', 10, 1 );
add_filter( 'pirate_parrot_log', 'visualizer_register_parrot', 10, 1 );

add_filter(
'themeisle_sdk_compatibilities/' . VISUALIZER_DIRNAME, function ( $compatibilities ) {
$compatibilities['VisualizerPRO'] = array(
'basefile' => defined( 'VISUALIZER_PRO_BASEFILE' ) ? VISUALIZER_PRO_BASEFILE : '',
'required' => '1.8',
'tested_up' => '1.12',
);
return $compatibilities;
}
);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions js/render-chartjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@

handleSettings(settings, chart);

const getChart = Chart.getChart(context);
if ( getChart ) {
return;
}

var chartjs = new Chart(context, {
type: type,
data: {
Expand Down
13 changes: 12 additions & 1 deletion js/render-google.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var chartWrapperError = [];
}

var controlWrapperElement = document.getElementById( "control_wrapper_" + id ) || null;
var withControlMode = typeof settings.controls !== 'undefined' && controlWrapperElement ? true : false;
var withControlMode = ( typeof settings.controls !== 'undefined' && '' !== settings.controls.controlType ) && controlWrapperElement ? true : false;

if ( $( controlWrapperElement ).hasClass( 'no-filter' ) ) {
withControlMode = false;
Expand Down Expand Up @@ -399,6 +399,7 @@ var chartWrapperError = [];
});

if ( withControlMode ) {
// alert( chart.is_library_page );
// Create a control wrapper, passing some options.
var controlWrapper = new gv.ControlWrapper( {
containerId: 'control_wrapper_' + id,
Expand All @@ -410,6 +411,16 @@ var chartWrapperError = [];
render.setOptions(settings);
chartWrapper.bind(controlWrapper, render);
chartWrapper.draw(table);

gv.events.addListener(controlWrapper, 'ready', function ( err ) {
if ( 'vertical' === settings.controls.ui.orientation ) {
if ( 'canvas' === id ) {
jQuery( '#' + id ).addClass( 'vz-vertical' );
}
} else {
jQuery( '#' + id ).removeClass( 'vz-vertical' );
}
});
} else {
$('body').trigger('visualizer:chart:settings:extend', {id: id, chart: chart, settings: settings, data: table});
render.draw(table, settings);
Expand Down
2 changes: 2 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<exclude name="Squiz.Commenting.InlineComment.NotCapital" />
<exclude name="Squiz.Commenting.FileComment" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket" />
<exclude name="WordPress.PHP.YodaConditions.NotYoda" />
<exclude name="Squiz.PHP.DisallowMultipleAssignments" />
<exclude name="WordPress.NamingConvention.ValidVariableName.StringNotSnakeCase" />
Expand Down
Loading