Exemplo n.º 1
0
function widget_logic_visual_list_visibility_on_widget($widgetID)
{
    $cond_tag = get_option($widgetID . '-conditional-tags');
    $cond_act = get_option($widgetID . '-conditional-tags-activate');
    $visibilities = get_option($widgetID . '-visibility');
    if (!is_null($cond_act) && !empty($cond_act)) {
        ?>
		<div class="nwlv-list-options">
        	this widget is using conditional tags <br />
			<code><?php 
        echo $cond_tag;
        ?>
</code>
        </div>
		<?php 
    } elseif (is_array($visibilities) && sizeof($visibilities) > 0) {
        foreach ($visibilities as $key => $option) {
            $not = isset($option['not']) && $option['not'] == 'not' ? "not" : "";
            $list_content = widget_logic_visual_list_contents($option);
            ?>
		<div class="nwlv-list-options">
			<?php 
            echo "<span style='font-weight:bold;color:red;'>" . $not . "</span>";
            ?>
 show in <strong><?php 
            echo $option['show'];
            ?>
</strong> page
			<span style="font-weight:bold;color:green;"><?php 
            echo $list_content;
            ?>
</span>
		</div>
		<?php 
        }
    } else {
        ?>
This widget has no limitation<?php 
    }
}
Exemplo n.º 2
0
function widget_logic_visual_list_visibility_options($widgetID)
{
    $visibilities = get_option($widgetID . '-visibility');
    $cond_tag = get_option($widgetID . '-conditional-tags');
    $cond_act = get_option($widgetID . '-conditional-tags-activate');
    if (!is_null($cond_act) && !empty($cond_act)) {
        ?>
	<div class="nwlv-list-options">
    	Current widget is using conditional tags()
        <code><?php 
        echo $cond_tag;
        ?>
</code>
    </div>
    <?php 
    } elseif (is_array($visibilities) && sizeof($visibilities) > 0) {
        foreach ($visibilities as $key => $option) {
            $not = isset($option['not']) && $option['not'] == 'not' ? "not" : "";
            $list_content = widget_logic_visual_list_contents($option);
            ?>
		<div class="nwlv-list-options">
			<a href="#" class="nwlv-edit-option button" rel="<?php 
            echo $key;
            ?>
">edit</a>
			<a href="#" class="nwlv-delete-option button" rel="<?php 
            echo $key;
            ?>
">delete</a> &nbsp;&nbsp;&nbsp;
			this widget will <?php 
            echo "<span style='font-weight:bold;color:red;'>" . $not . "</span>";
            ?>
 show in <strong><?php 
            echo $option['show'];
            ?>
</strong> page
			<span style="font-weight:bold;color:green;"><?php 
            echo $list_content;
            ?>
</span>
		</div>
		<?php 
        }
        ?>
		<script type="text/javascript" language="javascript1.2">
		jQuery(document).ready(function(){
			
			jQuery('.nwlv-edit-option').click(function(){
				
				var ajaxurl	= "<?php 
        echo admin_url('admin-ajax.php');
        ?>
";
				var data 	= {
								action		: 'widget-logic-edit-option',
								widgetID	: "<?php 
        echo $widgetID;
        ?>
",
								visOption	: jQuery(this).attr('rel')
							  };
								  
				jQuery.post(ajaxurl, data, function(response) {
					jQuery('#nwlv-add-option-holder').html(response);
				});
				
				return false;
			});
			
			jQuery('.nwlv-delete-option').click(function(){
	
				var ajaxurl	= "<?php 
        echo admin_url('admin-ajax.php');
        ?>
";
				var data 	= {
								action		: 'widget-logic-delete-option',
								widgetID	: "<?php 
        echo $widgetID;
        ?>
",
								visOption	: jQuery(this).attr('rel')
							  };
								  
				jQuery.post(ajaxurl, data, function(response) {
					
					jQuery('#nwlv-list-visibility').html(response);
					
					var ajaxurl	= "<?php 
        echo admin_url('admin-ajax.php');
        ?>
";
					var data 	= {
									action		: 'widget-logic-update-visibility',
									widgetID	: "<?php 
        echo $widgetID;
        ?>
"
								  };
								  
					jQuery.post(ajaxurl, data, function(response) {
						jQuery('#visibility-<?php 
        echo $widgetID;
        ?>
').html(response);
					});
				});
				
				return false;
			});
		});
		</script>
		<?php 
    } else {
        ?>
        <div>
        	<p>Choose an option to get started...</p>
            
            <p>"Add New Limitation" is point and click style widget placement</p>
            
            <p>
            	"Using Conditional Tag Code" is for advanced users that want to use wordpress template conditional tag code.<br />
                You can choose one or the other ( per widget )
            </p>
        </div>
        <?php 
    }
}