Skip to content

Commit 1865a38

Browse files
committed
Minor fixes
1 parent dc969a1 commit 1865a38

12 files changed

+201
-102
lines changed

admin.php

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ function mfbfw_options_page() {
55

66
?>
77

8-
<div class="wrap about-wrap full-width-layout fbfw-wrap">
8+
<div class="wrap about-wrap fbfw-wrap">
99
<div id="icon-plugins" class="icon32"></div>
1010
<div class="inlined">
1111
<div id="pluginDescription">
1212
<h1><?php printf( __( 'Fancybox for WordPress (version %s)', 'mfbfw' ), FBFW_VERSION ); ?></h1>
13-
<p class="about-text">Seamlessly integrates FancyBox into your blog: Upload, activate, and you’re done.
14-
Additional configuration optional.</p></div>
15-
<div id="pluginLogo"><img src="<?php echo FBFW_URL . 'assets/images/icon.jpg'; ?>"></div>
13+
<p class="about-text">Seamlessly integrates FancyBox into your blog: Upload, activate, and you’re done. Additional configuration optional.</p>
14+
</div>
1615
</div>
1716

1817
<br/>
@@ -80,15 +79,70 @@ class="button-secondary" value="<?php esc_attr_e( 'Revert to defaults', 'mfbfw'
8079
</div>
8180

8281
</div>
83-
<a href="https://wp-modula.com" class="modula-link">
84-
<div class="modula-wrap">
82+
83+
<div class="modula-wrap">
84+
<a target="_blank" href="http://wp-modula.com/?utm_source=fancybox-for-wp&utm_medium=options-page&utm_campaign=Modula%20Lite" class="modula-link">
8585
<img src="<?php echo FBFW_URL; ?>assets/images/modula-300x300.jpg"/>
86-
<h1>Easy Image Gallery for WP</h1>
87-
<p>Modula is creative! Modula is dynamic! Modula doesn’t always look the same. Just have fun with it! Modula
88-
uses a new concept to build its internal grid. The result is a dynamic, creative, interesting and attractive
89-
gallery.</p>
90-
</div>
91-
</a>
86+
<h2>Easy Image Gallery for WP</h2>
87+
<p>Modula is creative! Modula is dynamic! Modula doesn’t always look the same. Just have fun with it! Modula uses a new concept to build its internal grid. The result is a dynamic, creative, interesting and attractive gallery.</p>
88+
89+
<?php
90+
91+
$plugin_slug = 'modula-best-grid-gallery';
92+
$plugin_path = 'modula-best-grid-gallery/Modula.php';
93+
94+
$installed = false;
95+
$activated = false;
96+
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $plugin_slug ) ) {
97+
$installed = true;
98+
}
99+
100+
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $plugin_path ) ) {
101+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
102+
if ( is_plugin_active( $plugin_path ) ) {
103+
$activated = true;
104+
}
105+
}
106+
107+
if ( ! $activated ) {
108+
109+
if ( ! $installed ) {
110+
$label = esc_html__( 'Install & Activate Modula', 'mfbfw' );
111+
$link = wp_nonce_url(
112+
add_query_arg(
113+
array(
114+
'action' => 'install-plugin',
115+
'plugin' => $plugin_slug,
116+
),
117+
network_admin_url( 'update.php' )
118+
),
119+
'install-plugin_' . $plugin_slug
120+
);
121+
$action = 'install';
122+
}else{
123+
$label = esc_html__( 'Activate Modula', 'mfbfw' );
124+
$link = add_query_arg(
125+
array(
126+
'action' => 'activate',
127+
'plugin' => rawurlencode( $plugin_path ),
128+
'plugin_status' => 'all',
129+
'paged' => '1',
130+
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin_path ),
131+
),
132+
admin_url( 'plugins.php' )
133+
);
134+
$action = 'activate';
135+
}
136+
137+
echo '<a href="' . esc_url( $link ) . '" class="mfbfw-modula-link button button-primary button-large" data-action="' . esc_attr( $action ) . '">' . esc_html( $label ) . '</a>';
138+
139+
}
140+
141+
?>
142+
143+
</a>
144+
</div>
145+
92146

93147
<?php
94148
}

assets/css/fancybox-admin.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ tr.spacer {
341341
margin-top: 15px;
342342
}
343343

344-
.fbfw-wrap {
345-
max-width:80%;
344+
.about-wrap.fbfw-wrap {
345+
max-width:70%;
346346
float:left;
347347
}
348348

@@ -354,6 +354,10 @@ tr.spacer {
354354

355355
a.modula-link {
356356
color:#000;
357+
text-decoration: none;
358+
}
359+
a.modula-link:hover {
360+
text-decoration: none;
357361
}
358362

359363
.cf:after,
@@ -364,4 +368,9 @@ a.modula-link {
364368

365369
.cf:after {
366370
clear: both
371+
}
372+
373+
.about-wrap.fbfw-wrap .about-text,
374+
.about-wrap.fbfw-wrap h1 {
375+
margin-right: 0;
367376
}

assets/js/admin.js

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,52 @@ function confirmDefaults() {
122122

123123
var defaults_prompt = "Are you sure you want to restore FancyBox for WordPress to default settings?";
124124

125-
function revertVersion(){
125+
function activatePlugin( url ) {
126+
jQuery.ajax( {
127+
async: true,
128+
type: 'GET',
129+
dataType: 'html',
130+
url: url,
131+
success: function() {
132+
location.reload();
133+
}
134+
} );
135+
}
136+
137+
jQuery( '.mfbfw-modula-link' ).click(function(evt){
138+
evt.preventDefault();
139+
140+
var action = jQuery( this ).data( 'action' ),
141+
link = jQuery( this ).attr( 'href' );
126142

127-
}
143+
jQuery(this).addClass( 'updating-message' );
144+
jQuery(this).attr( 'disabled', 'disabled' );
145+
146+
if ( 'install' == action ) {
147+
wp.updates.installPlugin( { slug: 'modula-best-grid-gallery' } );
148+
}else{
149+
activatePlugin( link );
150+
}
151+
152+
});
153+
154+
jQuery( document ).on( 'wp-plugin-install-success', function( response, data ) {
155+
156+
if ( 'modula-best-grid-gallery' == data.slug ) {
157+
158+
jQuery.ajax( {
159+
type: 'POST',
160+
data: { action: 'mfbfw_activate_link' },
161+
dataType: 'json',
162+
url: ajaxurl,
163+
success: function( json ) {
164+
if ( json.status ) {
165+
activatePlugin( json.link );
166+
}
167+
}
168+
});
169+
170+
}
171+
console.log( response );
172+
console.log( data );
173+
});

fancybox.php

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
/*
44
Plugin Name: FancyBox for WordPress
5-
Plugin URI: http://plugins.josepardilla.com/fancybox-for-wordpress/
6-
Description: Integrates <a href="http://fancyapps.com/fancybox/3/">FancyBox</a> by <a href="http://klade.lv/">Janis Skarnelis</a> into WordPress.
7-
Version: 3.0.14
8-
Author: Jos&eacute; Pardilla
9-
Author URI: http://josepardilla.com/
5+
Plugin URI: https://wordpress.org/plugins/fancybox-for-wordpress/
6+
Description: Integrates <a href="http://fancyapps.com/fancybox/3/">FancyBox 3</a> into WordPress.
7+
Version: 3.1.0
8+
Author: Colorlib
9+
Author URI: https://colorlib.com/wp/
1010
1111
* FancyBox is Copyright (c) 2008 - 2010 Janis Skarnelis
1212
* Dual licensed under the MIT and GPL licenses:
@@ -19,11 +19,11 @@
1919
* Plugin Init
2020
*/
2121
// Constants
22-
define( 'FBFW_VERSION', '3.0.14' );
22+
define( 'FBFW_VERSION', '3.1.0' );
2323
define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
2424
define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
2525
define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
26-
define( 'FBFW_PREVIOUS_PLUGIN_VERSION', '3.0.10' );
26+
define( 'FBFW_PREVIOUS_PLUGIN_VERSION', '3.0.14' );
2727
define( 'FBFW_FILE_', __FILE__ );
2828
define( 'PLUGIN_NAME', 'fancybox-for-wordpress' );
2929

@@ -63,7 +63,7 @@ function mfbfw_defaults() {
6363
'paddingColor' => '#FFFFFF',
6464
'padding' => '10',
6565
'overlayShow' => 'on',
66-
'overlayColor' => '#000000',
66+
'overlayColor' => '#666666',
6767
'overlayOpacity' => '0.3',
6868
'titleShow' => 'on',
6969
'titlePosition' => 'inside',
@@ -458,12 +458,9 @@ function mfbfw_admin_styles() {
458458
}
459459

460460
function mfbfw_admin_scripts() {
461-
wp_enqueue_script( 'jquery-ui-tabs', array( 'jquery-ui-core' ) ); // Load jQuery UI Tabs JS for Admin Page
462-
wp_enqueue_script( 'wp-color-picker' );
463-
wp_enqueue_script( 'fancybox-admin', FBFW_URL . 'assets/js/admin.js', array(
464-
'jquery',
465-
'wp-color-picker'
466-
), FBFW_VERSION ); // Load specific JS for Admin Page
461+
print_r( $hook );
462+
wp_enqueue_script( 'jquery-ui-tabs', array( 'jquery-ui-core' ), true ); // Load jQuery UI Tabs JS for Admin Page
463+
wp_enqueue_script( 'fancybox-admin', FBFW_URL . 'assets/js/admin.js', array( 'jquery', 'wp-color-picker', 'updates' ), FBFW_VERSION, true ); // Load specific JS for Admin Page
467464

468465
/* Load codemirror editor */
469466
$settings = wp_enqueue_code_editor( array( 'type' => 'text/javascript' ) );
@@ -517,7 +514,6 @@ function hexTorgba( $hexColor, $opacity ) {
517514
* Check if WooCommerce Product post
518515
*
519516
*/
520-
521517
function fancy_check_if_woocommerce() {
522518
if ( class_exists( 'WooCommerce' ) ) {
523519
if ( is_shop() ) {
@@ -530,4 +526,31 @@ function fancy_check_if_woocommerce() {
530526
} else {
531527
return 'true';
532528
}
529+
}
530+
531+
// Ajax request for activate link
532+
add_action( 'wp_ajax_mfbfw_activate_link', 'mfbfw_get_activate_link' );
533+
function mfbfw_get_activate_link() {
534+
535+
$plugin_path = 'modula-best-grid-gallery/Modula.php';
536+
$link = add_query_arg(
537+
array(
538+
'action' => 'activate',
539+
'plugin' => rawurlencode( $plugin_path ),
540+
'plugin_status' => 'all',
541+
'paged' => '1',
542+
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin_path ),
543+
),
544+
admin_url( 'plugins.php' )
545+
);
546+
547+
wp_die(
548+
wp_json_encode(
549+
array(
550+
'status' => 'succes',
551+
'link' => $link,
552+
)
553+
)
554+
);
555+
533556
}

lib/admin-tab-animations.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
</fieldset>
1818
</td>
1919
</tr>
20-
<tr class="spacer"></tr>
2120
<tr valign="top">
2221
<th scope="row"><?php _e( 'Animation Type', 'mfbfw' ); ?></th>
2322
<td>
@@ -47,7 +46,6 @@
4746
</fieldset>
4847
</td>
4948
</tr>
50-
<tr class="spacer"></tr>
5149
<tr valign="top">
5250
<th scope="row"><?php _e( 'Animation between slides Options', 'mfbfw' ); ?></th>
5351
<td>

lib/admin-tab-appearance.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
</fieldset>
2020
</td>
2121
</tr>
22-
<tr class="spacer"></tr>
2322
<tr valign="top">
2423
<th scope="row"><?php _e( 'Toolbar', 'mfbfw' ); ?></th>
2524
<td>
@@ -35,7 +34,6 @@
3534
</fieldset>
3635
</td>
3736
</tr>
38-
<tr class="spacer"></tr>
3937
<tr valign="top">
4038
<th scope="row"><?php _e( 'Border', 'mfbfw' ); ?></th>
4139
<td>
@@ -57,7 +55,6 @@
5755
</fieldset>
5856
</td>
5957
</tr>
60-
<tr class="spacer"></tr>
6158
<tr valign="top">
6259
<th scope="row"><?php _e( 'Padding', 'mfbfw' ); ?></th>
6360
<td>
@@ -80,7 +77,6 @@
8077
</fieldset>
8178
</td>
8279
</tr>
83-
<tr class="spacer"></tr>
8480
<tr valign="top">
8581
<th scope="row"><?php _e( 'Overlay Options', 'mfbfw' ); ?></th>
8682
<td>
@@ -111,7 +107,6 @@
111107
</fieldset>
112108
</td>
113109
</tr>
114-
<tr class="spacer"></tr>
115110
<tr valign="top">
116111
<th scope="row"><?php _e( 'Title', 'mfbfw' ); ?></th>
117112
<td>
@@ -166,7 +161,6 @@ class="colorpick" value="<?php echo $settings['titleColor']; ?>" size="7"
166161
</fieldset>
167162
</td>
168163
</tr>
169-
<tr class="spacer"></tr>
170164
<tr valign="top">
171165
<th scope="row"><?php _e( 'Navigation Arrows', 'mfbfw' ); ?></th>
172166
<td>

lib/admin-tab-behaviour.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
</fieldset>
2020
</td>
2121
</tr>
22-
<tr class="spacer"></tr>
2322
<tr valign="top">
2423
<th scope="row"><?php _e( 'Close on Overlay Click', 'mfbfw' ); ?></th>
2524
<td>
@@ -34,7 +33,6 @@
3433
</fieldset>
3534
</td>
3635
</tr>
37-
<tr class="spacer"></tr>
3836
<tr valign="top">
3937
<th scope="row"><?php _e( 'Keyboard navigation;', 'mfbfw' ); ?></th>
4038
<td>
@@ -49,7 +47,6 @@
4947
</fieldset>
5048
</td>
5149
</tr>
52-
<tr class="spacer"></tr>
5350
<tr valign="top">
5451
<th scope="row"><?php _e( 'Loop Galleries', 'mfbfw' ); ?></th>
5552
<td>
@@ -64,7 +61,6 @@
6461
</fieldset>
6562
</td>
6663
</tr>
67-
<tr class="spacer"></tr>
6864
<tr valign="top">
6965
<th scope="row"><?php _e( 'Mouse Wheel Navigation', 'mfbfw' ); ?></th>
7066
<td>
@@ -79,7 +75,6 @@
7975
</fieldset>
8076
</td>
8177
</tr>
82-
<tr class="spacer"></tr>
8378
<tr valign="top">
8479
<th scope="row"><?php _e( 'Woocommerce:', 'mfbfw' ); ?></th>
8580
<td>

0 commit comments

Comments
 (0)