Skip to content

Commit e82ab3f

Browse files
Merge pull request #471 from contactashish13/issue-464
Create main menu with support page
2 parents 358e166 + 21ec542 commit e82ab3f

File tree

17 files changed

+419
-15
lines changed

17 files changed

+419
-15
lines changed

classes/Visualizer/Module/Admin.php

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,33 @@ public function setupVisualizerTab( $tabs ) {
582582
* @access public
583583
*/
584584
public function registerAdminMenu() {
585-
$title = esc_html__( 'Visualizer Library', 'visualizer' );
586-
$callback = array( $this, 'renderLibraryPage' );
587-
$this->_libraryPage = add_submenu_page( 'upload.php', $title, $title, 'edit_posts', Visualizer_Plugin::NAME, $callback );
585+
$svg_base64_icon = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNzdweCIgaGVpZ2h0PSI3N3B4IiB2aWV3Qm94PSIwIDAgNzcgNzciIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjYgKDY3NDkxKSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5Db21iaW5lZCBTaGFwZTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxnIGlkPSJQcm9kdWN0LVBhZ2UiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXb3JkUHJlc3MtcGx1Z2lucyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE5MC4wMDAwMDAsIC00Mz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666 );
588+
589+
add_submenu_page(
590+
Visualizer_Plugin::NAME,
591+
__( 'Chart Library', 'visualizer' ),
592+
__( 'Chart Library', 'visualizer' ),
593+
'edit_posts',
594+
admin_url( 'admin.php?page=' . Visualizer_Plugin::NAME )
595+
);
596+
add_submenu_page(
597+
Visualizer_Plugin::NAME,
598+
__( 'Add New Chart', 'visualizer' ),
599+
__( 'Add New Chart', 'visualizer' ),
600+
'edit_posts',
601+
admin_url( 'admin.php?page=' . Visualizer_Plugin::NAME . '&vaction=addnew' )
602+
);
603+
add_submenu_page(
604+
Visualizer_Plugin::NAME,
605+
__( 'Support', 'visualizer' ),
606+
__( 'Support', 'visualizer' ) . '<span class="dashicons dashicons-editor-help more-features-icon" style="width: 17px; height: 17px; margin-left: 4px; color: #ffca54; font-size: 17px; vertical-align: -3px;"></span>',
607+
'edit_posts',
608+
'viz-support',
609+
array( $this, 'renderSupportPage' )
610+
);
611+
remove_submenu_page( Visualizer_Plugin::NAME, Visualizer_Plugin::NAME );
588612
}
589613

590614
/**
@@ -643,6 +667,18 @@ private function getQuery() {
643667
return $q;
644668
}
645669

670+
/**
671+
* Renders support page.
672+
*
673+
* @since 3.3.0
674+
*
675+
* @access public
676+
*/
677+
public function renderSupportPage() {
678+
wp_enqueue_style( 'visualizer-upsell', VISUALIZER_ABSURL . 'css/upsell.css', array(), Visualizer_Plugin::VERSION );
679+
include_once VISUALIZER_ABSPATH . '/templates/support.php';
680+
}
681+
646682
/**
647683
* Renders visualizer library page.
648684
*
@@ -724,20 +760,22 @@ public function renderLibraryPage() {
724760
'map_api_key' => get_option( 'visualizer-map-api-key' ),
725761
'charts' => $charts,
726762
'urls' => array(
727-
'base' => add_query_arg( 'vpage', false ),
763+
'base' => add_query_arg( array( 'vpage' => false, 'vaction' => false ) ),
728764
'create' => add_query_arg(
729765
array(
730766
'action' => Visualizer_Plugin::ACTION_CREATE_CHART,
731767
'library' => 'yes',
732768
'type' => isset( $_GET['type'] ) ? $_GET['type'] : '',
733769
'chart-library' => isset( $_GET['chart-library'] ) ? $_GET['chart-library'] : '',
770+
'vaction' => false,
734771
),
735772
$ajaxurl
736773
),
737774
'edit' => add_query_arg(
738775
array(
739776
'action' => Visualizer_Plugin::ACTION_EDIT_CHART,
740777
'library' => 'yes',
778+
'vaction' => false,
741779
),
742780
$ajaxurl
743781
),
@@ -754,7 +792,7 @@ public function renderLibraryPage() {
754792
$render->custom_css = $css;
755793
$render->pagination = paginate_links(
756794
array(
757-
'base' => add_query_arg( 'vpage', '%#%' ),
795+
'base' => add_query_arg( array( 'vpage' => '%#%', 'vaction' => false ) ),
758796
'format' => '',
759797
'current' => $page,
760798
'total' => $query->max_num_pages,
@@ -782,7 +820,7 @@ public function getPluginActionLinks( $links, $file ) {
782820
$links,
783821
sprintf(
784822
'<a href="%s">%s</a>',
785-
admin_url( 'upload.php?page=' . Visualizer_Plugin::NAME ),
823+
admin_url( 'admin.php?page=' . Visualizer_Plugin::NAME ),
786824
esc_html__( 'Library', 'visualizer' )
787825
)
788826
);
@@ -807,7 +845,7 @@ public function getPluginMetaLinks( $plugin_meta, $plugin_file ) {
807845
if ( $plugin_file === plugin_basename( VISUALIZER_BASEFILE ) ) {
808846
// knowledge base link
809847
$plugin_meta[] = sprintf(
810-
'<a href="https://docs.themeisle.com/category/657-visualizer" target="_blank">%s</a>',
848+
'<a href="' . VISUALIZER_MAIN_DOC . '" target="_blank">%s</a>',
811849
esc_html__( 'Docs', 'visualizer' )
812850
);
813851
// flattr link

classes/Visualizer/Module/Chart.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function deleteChart() {
380380
)
381381
);
382382
}
383-
wp_redirect( wp_get_referer() );
383+
wp_redirect( remove_query_arg( 'vaction', wp_get_referer() ) );
384384
exit;
385385
}
386386

@@ -1040,7 +1040,7 @@ public function cloneChart() {
10401040
$success = $chart && $chart->post_type === Visualizer_Plugin::CPT_VISUALIZER;
10411041
}
10421042
}
1043-
$redirect = wp_get_referer();
1043+
$redirect = remove_query_arg( 'vaction', wp_get_referer() );
10441044
if ( $success ) {
10451045
$new_chart_id = wp_insert_post(
10461046
array(
@@ -1061,8 +1061,9 @@ public function cloneChart() {
10611061
array(
10621062
'page' => 'visualizer',
10631063
'type' => filter_input( INPUT_GET, 'type' ),
1064+
'vaction' => false,
10641065
),
1065-
admin_url( 'upload.php' )
1066+
admin_url( 'admin.php' )
10661067
);
10671068
}
10681069
}

classes/Visualizer/Module/Setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function onActivation( $plugin ) {
155155
}
156156

157157
if ( $plugin === VISUALIZER_BASENAME ) {
158-
wp_redirect( admin_url( 'upload.php?page=' . Visualizer_Plugin::NAME ) );
158+
wp_redirect( admin_url( 'admin.php?page=' . Visualizer_Plugin::NAME ) );
159159
exit();
160160
}
161161
}

classes/Visualizer/Render/Library.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private function _renderLibrary() {
8282
echo '<div id="visualizer-types" class="visualizer-clearfix">';
8383
echo '<ul class="subsubsub">';
8484
// All tab.
85-
echo '<li class="visualizer-list-item all"><a class="' . ( ! isset( $_GET['type'] ) || empty( $_GET['type'] ) ? 'current' : '' ) . '" href="', esc_url( add_query_arg( array( 'vpage' => false, 'type' => false, 's' => false ) ) ), '">' . __( 'All', 'visualizer' ) . '</a> | </li>';
85+
echo '<li class="visualizer-list-item all"><a class="' . ( ! isset( $_GET['type'] ) || empty( $_GET['type'] ) ? 'current' : '' ) . '" href="', esc_url( add_query_arg( array( 'vpage' => false, 'type' => false, 'vaction' => false, 's' => false ) ) ), '">' . __( 'All', 'visualizer' ) . '</a> | </li>';
8686
foreach ( $this->types as $type => $array ) {
8787
if ( ! is_array( $array ) ) {
8888
// support for old pro
@@ -94,6 +94,7 @@ private function _renderLibrary() {
9494
array(
9595
'type' => $type,
9696
'vpage' => false,
97+
'vaction' => false,
9798
's' => false,
9899
)
99100
)

classes/Visualizer/Render/Page/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ class="dashicons dashicons-lock"></span></h2>
440440
</li>
441441

442442
<li class="viz-group viz-group-category bottom-fixed sidebar-footer-link" id="vz-chart-docs">
443-
<h2><span class="dashicons dashicons-editor-help"></span><a href="https://docs.themeisle.com/category/657-visualizer" target="_blank"><?php _e( 'Docs', 'visualizer' ); ?></a></h2>
443+
<h2><span class="dashicons dashicons-editor-help"></span><a href="<?php echo VISUALIZER_MAIN_DOC; ?>" target="_blank"><?php _e( 'Docs', 'visualizer' ); ?></a></h2>
444444
</li>
445445

446446
<?php $this->getPermissionsLink( $this->chart->ID ); ?>

classes/Visualizer/Render/Page/Types.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ protected function _renderToolbar() {
129129
}
130130
?>
131131
<input type="submit" class="button button-primary button-large push-right" value="<?php esc_attr_e( 'Next', 'visualizer' ); ?>">
132+
<input type="button" class="button button-secondary button-large push-left viz-abort" value="<?php esc_attr_e( 'Cancel', 'visualizer' ); ?>">
132133
<?php
133134
}
134135
}

css/upsell.css

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#viz-features .pro-features-header {
2+
padding: 20px 10px;
3+
border-top: 5px solid #252b37;
4+
background: #fff;
5+
}
6+
7+
#viz-features .logo {
8+
display: inline-block;
9+
margin: 0 0 0 20px;
10+
padding: 0 0 0 70px;
11+
color: #3c3c3c;
12+
background: url(../img/wppr-logo.png) no-repeat left center;
13+
font-family: "Open Sans", sans-serif;
14+
font-size: 2em;
15+
font-weight: 700;
16+
line-height: 60px;
17+
letter-spacing: -1px;
18+
}
19+
20+
#viz-features .slogan {
21+
display: inline-block;
22+
margin: 0 0 0 5px;
23+
padding: 0;
24+
color: #858585;
25+
font-family: "Open Sans", sans-serif;
26+
font-size: 17px;
27+
line-height: 3.5;
28+
}
29+
30+
#viz-features .slogan a {
31+
color: #858585;
32+
font-weight: 600;
33+
font-style: italic;
34+
text-decoration: none;
35+
transition: all 0.250s ease-in-out;
36+
}
37+
38+
#viz-features .slogan a:hover {
39+
color: #ff6160;
40+
}
41+
42+
#viz-features .slogan a:focus {
43+
outline: none;
44+
box-shadow: none;
45+
}
46+
47+
#viz-features .header-btns {
48+
float: right;
49+
margin: 7px 20px;
50+
text-align: right;
51+
}
52+
53+
#viz-features .header-btns .buy-now {
54+
display: inline-block;
55+
margin-top: 2px;
56+
margin-right: 5px;
57+
padding: 15px 25px;
58+
border-radius: 3px;
59+
border-radius: 3px;
60+
color: #fff;
61+
background: #e33b3f;
62+
font-family: "Open Sans", sans-serif;
63+
font-size: 18px;
64+
font-weight: bold;
65+
text-decoration: none;
66+
text-transform: uppercase;
67+
transition: all 0.250s ease-in-out;
68+
}
69+
70+
#viz-features .header-btns .buy-now:hover {
71+
background: #252b37;
72+
}
73+
74+
#viz-features .header-btns .buy-now .dashicons {
75+
padding-right: 3px;
76+
}
77+
78+
#viz-features .pro-features-header,
79+
#viz-features .pro-feature {
80+
display: block;
81+
margin: 10px;
82+
box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
83+
}
84+
85+
#viz-features .pro-feature .pro-feature-features,
86+
#viz-features .pro-feature .pro-feature-image {
87+
display: table-cell;
88+
margin: 0;
89+
vertical-align: middle;
90+
}
91+
92+
#viz-features .pro-feature .pro-feature-features {
93+
box-sizing: border-box;
94+
padding: 30px;
95+
}
96+
97+
#viz-features .pro-feature .pro-feature-image {
98+
width: 470px;
99+
}
100+
101+
#viz-features .pro-feature .pro-feature-features h2 {
102+
margin: 0 0 20px;
103+
font-size: 28px;
104+
}
105+
106+
#viz-features .pro-feature .pro-feature-features h4 {
107+
margin: 0 0 10px;
108+
font-size: 20px;
109+
}
110+
111+
#viz-features .pro-feature .pro-feature-features p {
112+
margin: 0 0 15px;
113+
font-size: 16px;
114+
line-height: 1.5;
115+
}
116+
117+
#viz-features .pro-feature .pro-feature-image img {
118+
width: 100%;
119+
height: auto;
120+
}
121+
122+
@media screen and (max-width: 1200px) {
123+
#viz-features .pro-feature .pro-feature-features,
124+
#viz-features .pro-feature .pro-feature-image {
125+
display: block;
126+
}
127+
128+
#viz-features .pro-feature .pro-feature-image {
129+
width: 470px;
130+
margin: 0 auto 20px;
131+
text-align: center;
132+
}
133+
134+
#viz-features .slogan {
135+
display: none;
136+
}
137+
}
138+
139+
@media screen and (max-width: 1100px) {
140+
#viz-features {
141+
text-align: center;
142+
}
143+
144+
#viz-features .logo {
145+
margin-left: 0;
146+
}
147+
148+
#viz-features .header-btns {
149+
display: block;
150+
float: none;
151+
margin: 0 0 10px 0;
152+
text-align: center;
153+
}
154+
}
155+
156+
@media screen and (max-width: 782px) {
157+
#cwp_form #header .button {
158+
padding: 0 4px 1px !important;
159+
font-size: 11px !important;
160+
}
161+
162+
#cwp_form #header .logo h2 {
163+
margin: 0 !important;
164+
padding: 0 !important;
165+
}
166+
167+
#viz-features .pro-feature .pro-feature-image {
168+
width: 100%;
169+
}
170+
}
171+
172+
#viz-features .pro-feature .pro-feature-inner {
173+
display: table;
174+
width: 100%;
175+
background: #fff;
176+
}

images/pro/excel.png

9.39 KB
Loading

images/pro/import.png

19.4 KB
Loading

images/pro/more_charts.png

171 KB
Loading

0 commit comments

Comments
 (0)