acf.php
2 months ago
alignment.php
2 months ago
animation.php
2 months ago
beaver_builder.php
2 months ago
cache.php
2 months ago
classes.php
2 months ago
classic-widgets-screen.php
2 months ago
clone.php
2 months ago
columns.php
2 months ago
custom-sidebar.php
2 months ago
dates.php
2 months ago
devices.php
2 months ago
disable_widgets.php
2 months ago
elementor.php
2 months ago
fixed.php
2 months ago
import-export.php
2 months ago
links.php
2 months ago
logic.php
2 months ago
move.php
2 months ago
page-and-post-block.php
2 months ago
permission.php
2 months ago
roles.php
2 months ago
search.php
2 months ago
shortcodes.php
2 months ago
sidebar-more_plugins.php
2 months ago
sidebar-opt_in.php
2 months ago
sidebar-support_box.php
2 months ago
sidebar-upsell_pro.php
2 months ago
siteorigin.php
2 months ago
sliding.php
2 months ago
state.php
2 months ago
styling.php
2 months ago
taxonomies.php
2 months ago
title.php
2 months ago
urls.php
2 months ago
visibility.php
2 months ago
widget-area.php
2 months ago
logic.php
107 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Widget Logic Settings Module |
| 4 | * Settings > Widget Options :: Display Logic |
| 5 | * |
| 6 | * @copyright Copyright (c) 2016, Jeffrey Carandang |
| 7 | * @since 3.0 |
| 8 | */ |
| 9 | |
| 10 | // Exit if accessed directly |
| 11 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 12 | |
| 13 | /** |
| 14 | * Create Card Module for Display Logic Options |
| 15 | * |
| 16 | * @since 3.0 |
| 17 | * @global $widget_options |
| 18 | * @return void |
| 19 | */ |
| 20 | if( !function_exists( 'widgetopts_settings_logic' ) ): |
| 21 | function widgetopts_settings_logic(){ |
| 22 | global $widget_options; ?> |
| 23 | <li class="widgetopts-module-card <?php echo ( isset( $widget_options['logic'] ) && $widget_options['logic'] == 'activate' ) ? 'widgetopts-module-type-enabled' : 'widgetopts-module-type-disabled'; ?>" id="widgetopts-module-card-logic" data-module-id="logic"> |
| 24 | <div class="widgetopts-module-card-content"> |
| 25 | <h2><?php _e( 'Display Logic', 'widget-options' );?></h2> |
| 26 | <p class="widgetopts-module-desc"> |
| 27 | <?php _e( 'Use WordPress PHP conditional tags to assign each widgets visibility.', 'widget-options' );?> |
| 28 | </p> |
| 29 | |
| 30 | <div class="widgetopts-module-actions hide-if-no-js"> |
| 31 | <?php if( $widget_options['logic'] == 'activate' ){ ?> |
| 32 | <button class="button button-secondary widgetopts-toggle-settings"><?php _e( 'Configure Settings', 'widget-options' );?></button> |
| 33 | <button class="button button-secondary widgetopts-toggle-activation"><?php _e( 'Disable', 'widget-options' );?></button> |
| 34 | <?php if( current_user_can( 'manage_options' ) ){ ?> |
| 35 | <a href="<?php echo admin_url('edit.php?post_type=widgetopts_snippet'); ?>" class="button button-secondary widgetopts-manage-snippets-btn" style="margin-left: 5px;"> |
| 36 | <?php _e( 'Manage Snippets', 'widget-options' );?> |
| 37 | </a> |
| 38 | <?php } ?> |
| 39 | <?php if( current_user_can( WIDGETOPTS_MIGRATION_PERMISSIONS ) ){ ?> |
| 40 | <a href="<?php echo admin_url('options-general.php?page=widgetopts_migration'); ?>" class="button button-secondary widgetopts-migrate-btn" style="margin-left: 5px;"> |
| 41 | <?php _e( 'Migrate', 'widget-options' );?> |
| 42 | </a> |
| 43 | <?php } ?> |
| 44 | <?php }else{ ?> |
| 45 | <button class="button button-secondary widgetopts-toggle-settings"><?php _e( 'Learn More', 'widget-options' );?></button> |
| 46 | <button class="button button-primary widgetopts-toggle-activation"><?php _e( 'Enable', 'widget-options' );?></button> |
| 47 | <?php if( current_user_can( 'manage_options' ) ){ ?> |
| 48 | <a href="<?php echo admin_url('edit.php?post_type=widgetopts_snippet'); ?>" class="button button-secondary widgetopts-manage-snippets-btn" style="margin-left: 5px; display: none;"> |
| 49 | <?php _e( 'Manage Snippets', 'widget-options' );?> |
| 50 | </a> |
| 51 | <?php } ?> |
| 52 | <?php if( current_user_can( WIDGETOPTS_MIGRATION_PERMISSIONS ) ){ ?> |
| 53 | <a href="<?php echo admin_url('options-general.php?page=widgetopts_migration'); ?>" class="button button-secondary widgetopts-migrate-btn" style="margin-left: 5px; display: none;"> |
| 54 | <?php _e( 'Migrate', 'widget-options' );?> |
| 55 | </a> |
| 56 | <?php } ?> |
| 57 | <?php } ?> |
| 58 | |
| 59 | </div> |
| 60 | |
| 61 | </div> |
| 62 | |
| 63 | <?php widgetopts_modal_start( $widget_options['logic'] ); ?> |
| 64 | <span class="dashicons widgetopts-dashicons widgetopts-no-top dashicons-admin-generic"></span> |
| 65 | <h3 class="widgetopts-modal-header"><?php _e( 'Display Logic', 'widget-options' );?></h3> |
| 66 | <p> |
| 67 | <?php _e( 'Display Widget Logic will let you control where you want the widgets to appear using WordPress conditional tags.', 'widget-options' );?> |
| 68 | </p> |
| 69 | <p> |
| 70 | <?php _e( "<strong>Please note</strong> that the display logic you introduce is EVAL'd directly. Anyone who has access to edit widget appearance will have the right to add any code, including malicious and possibly destructive functions. There is an optional filter <code>widget_options_logic_override</code> which you can use to bypass the EVAL with your own code if needed.", 'widget-options' )?> |
| 71 | </p> |
| 72 | <table class="form-table widgetopts-settings-section"> |
| 73 | <tr> |
| 74 | <th scope="row"> |
| 75 | <label for="widgetopts-logic-notice"><?php _e( 'Hide Notice', 'widget-options' );?></label> |
| 76 | </th> |
| 77 | <td> |
| 78 | <input type="checkbox" id="widgetopts-logic-notice" name="logic[notice]" <?php echo ( isset( $widget_options['settings']['logic'] ) ) ? widgetopts_is_checked( $widget_options['settings']['logic'], 'notice' ) : ''; ?> value="1" /> |
| 79 | <label for="widgetopts-logic-notice"><?php _e( 'Disable Notice Toggler', 'widget-options' );?></label> |
| 80 | <p class="description"> |
| 81 | <?php _e( 'Hide similar filter notice above on each widget display logic feature.', 'widget-options' );?> |
| 82 | </p> |
| 83 | </td> |
| 84 | </tr> |
| 85 | <tr> |
| 86 | <th scope="row"> |
| 87 | <label><?php _e( 'Logic Snippets', 'widget-options' );?></label> |
| 88 | </th> |
| 89 | <td> |
| 90 | <a href="<?php echo admin_url('edit.php?post_type=widgetopts_snippet'); ?>" class="button button-secondary"> |
| 91 | <?php _e( 'Manage Logic Snippets', 'widget-options' );?> |
| 92 | </a> |
| 93 | <p class="description"> |
| 94 | <?php _e( 'Create and manage reusable display logic snippets for your widgets.', 'widget-options' );?> |
| 95 | </p> |
| 96 | </td> |
| 97 | </tr> |
| 98 | </table> |
| 99 | <?php widgetopts_modal_end( $widget_options['logic'] ); ?> |
| 100 | |
| 101 | </li> |
| 102 | <?php |
| 103 | } |
| 104 | add_action( 'widgetopts_module_cards', 'widgetopts_settings_logic', 60 ); |
| 105 | endif; |
| 106 | ?> |
| 107 |