Exemple #1
0
 function create_settings()
 {
     //region General Tab
     $tabs['general'] = __('General', 'foobox-free');
     $sections['attach'] = array('tab' => 'general', 'name' => __('What do you want to attach FooBox to?', 'foobox-free'));
     $settings[] = array('id' => 'enable_galleries', 'title' => __('WordPress Galleries', 'foobox-free'), 'desc' => __('Enable FooBox for all WordPress image galleries.', 'foobox-free'), 'default' => 'on', 'type' => 'checkbox', 'section' => 'attach', 'tab' => 'general');
     $settings[] = array('id' => 'enable_captions', 'title' => __('WordPress Images With Captions', 'foobox-free'), 'desc' => __('Enable FooBox for all WordPress images that have captions.', 'foobox-free'), 'default' => 'on', 'type' => 'checkbox', 'section' => 'attach', 'tab' => 'general');
     $settings[] = array('id' => 'enable_attachments', 'title' => __('Attachment Images', 'foobox-free'), 'desc' => __('Enable FooBox for all media images included in posts or pages.', 'foobox-free'), 'default' => 'on', 'type' => 'checkbox', 'section' => 'attach', 'tab' => 'general');
     $sections['show_love'] = array('tab' => 'settings', 'name' => __('Show us some love! We would really appreciate your support.', 'foobox-free'));
     $settings[] = array('id' => 'powered_by_link', 'title' => __('Show "powered by" link', 'foobox-free'), 'desc' => __('Help support this free plugin by displaying a small "powered by foobox" link under the lightbox.', 'foobox-free') . '<br />' . __('View the demo on this page to see the "powered by" link in action.', 'foobox-free'), 'default' => 'off', 'type' => 'checkbox', 'section' => 'show_love', 'tab' => 'general');
     $become_affiliate_link = sprintf('<br /><a target="_blank" href="%s">%s</a> %s', Foobox_Free::BECOME_AFFILIATE_URL, __('Become an affiliate', 'foobox-free'), __(' and paste in your affiliate URL above.', 'foobox-free'));
     $settings[] = array('id' => 'powered_by_url', 'title' => __('Affiliate Link', 'foobox-free'), 'desc' => __('If you show the "powered by" link, you can promote FooBox and make a commission from sales. Everybody wins!', 'foobox-free') . $become_affiliate_link, 'type' => 'text', 'section' => 'show_love', 'tab' => 'general');
     $sections['settings'] = array('tab' => 'settings', 'name' => __('Display Settings', 'foobox-free'));
     $settings[] = array('id' => 'fit_to_screen', 'title' => __('Fit To Screen', 'foobox-free'), 'desc' => __('Force smaller images to fit the screen dimensions.', 'foobox-free'), 'default' => 'off', 'type' => 'checkbox', 'section' => 'settings', 'tab' => 'general');
     $settings[] = array('id' => 'hide_scrollbars', 'title' => __('Hide Page Scrollbars', 'foobox-free'), 'desc' => __('Hide the page\'s scrollbars when FooBox is visible.', 'foobox-free'), 'default' => 'on', 'type' => 'checkbox', 'section' => 'settings', 'tab' => 'general');
     $settings[] = array('id' => 'show_count', 'title' => __('Show Counter', 'foobox-free'), 'desc' => __('Shows a counter under the FooBox modal when viewing a gallery of images.', 'foobox-free'), 'default' => 'on', 'type' => 'checkbox', 'section' => 'settings', 'tab' => 'general');
     $settings[] = array('id' => 'captions_show_on_hover', 'title' => __('Show Captions On Hover', 'foobox-free'), 'desc' => __('Only show the caption when hovering over the image.', 'foobox-free'), 'type' => 'checkbox', 'section' => 'settings', 'tab' => 'general');
     $settings[] = array('id' => 'error_message', 'title' => __('Error Message', 'foobox-free'), 'desc' => __('The error message to display when an image has trouble loading.', 'foobox-free'), 'default' => __('Could not load the item', 'foobox-free'), 'type' => 'text', 'section' => 'settings', 'tab' => 'general');
     //endregion
     //region Advanced Tab
     $tabs['advanced'] = __('Advanced', 'foobox-free');
     $settings[] = array('id' => 'close_overlay_click', 'title' => __('Close On Overlay Click', 'foobox-free'), 'desc' => __('Should the FooBox lightbox close when the overlay is clicked.', 'foobox-free'), 'default' => 'on', 'type' => 'checkbox', 'tab' => 'advanced');
     $settings[] = array('id' => 'disable_others', 'title' => __('Disable Other Lightboxes', 'foobox-free'), 'desc' => __('Certain themes and plugins use a hard-coded lightbox, which make it very difficult to override.<br>By enabling this setting, we inject a small amount of javascript onto the page which attempts to get around this issue.<br>But please note this is not guaranteed, as we cannot account for every lightbox solution out there :)', 'foobox-free'), 'type' => 'checkbox', 'tab' => 'advanced');
     $settings[] = array('id' => 'enable_debug', 'title' => __('Enable Debug Mode', 'foobox-free'), 'desc' => __('Show an extra debug information tab to help debug any issues.', 'foobox-free'), 'type' => 'checkbox', 'tab' => 'advanced');
     //endregion
     //region Debug Tab
     $foobox_free = Foobox_Free::get_instance();
     if ($foobox_free->options()->is_checked('enable_debug', false)) {
         $tabs['debug'] = __('Debug', 'foobox-free');
         $settings[] = array('id' => 'debug_output', 'title' => __('Debug Information', 'foobox-free'), 'type' => 'debug_output', 'tab' => 'debug');
     }
     //endregion
     //region 'FooBot Says' tab
     $tabs['foobot_says'] = __('FooBot Says...', 'foobox-free');
     $settings[] = array('id' => 'upgrade', 'title' => '', 'type' => 'foobot_says', 'tab' => 'foobot_says');
     //endregion
     //region Upgrade tab
     $tabs['upgrade'] = __('Upgrade to PRO!', 'foobox-free');
     $link = sprintf('<p><a target="_blank" href="%s">%s</a></p><br>', FooBox_Free::FOOBOX_URL, __('Upgrade to the PRO version!', 'foobox-free'));
     $settings[] = array('id' => 'upgrade', 'title' => $link . __('There are tons of reasons...', 'foobox-free'), 'type' => 'upgrade', 'tab' => 'upgrade');
     //endregion
     return array('tabs' => $tabs, 'sections' => $sections, 'settings' => $settings);
 }
Exemple #2
0
        }
        function admin_notice_ignore()
        {
            /* If user clicks to dismiss the notice, add that to their user meta */
            if (isset($_GET['foogallery_did_you_know_ignore']) && '0' == $_GET['foogallery_did_you_know_ignore']) {
                add_user_meta(get_current_user_id(), 'foogallery_did_you_know', 'true', true);
                /* Gets where the user came from after they click Hide Notice */
                if (wp_get_referer()) {
                    /* Redirects user to where they were before */
                    wp_safe_redirect(wp_get_referer());
                } else {
                    /* just in case */
                    wp_safe_redirect(admin_url());
                }
            }
        }
    }
}
Foobox_Free::get_instance();
/**
 * Activation check - make sure the FREE and PRO versions are not both running
 */
function foobox_free_activation_check()
{
    if (class_exists('fooboxV2')) {
        deactivate_plugins(plugin_basename(__FILE__));
        // Deactivate ourself
        die(__('Sorry, but you can\'t run the FREE and PRO version of FooBox at the same time!', 'foobox-free'));
    }
}
register_activation_hook(__FILE__, 'foobox_free_activation_check');