<div class="title"> <?php 
    _e("Bulk edit", "maxbuttons");
    ?>
</div>
     
      	<div class="inside"  >
      	<p><strong><?php 
    _e("Using Bulk editor MAY and probably WILL destroy your buttons. In case you wish to prevent this - please BACKUP all your buttons before proceeding!", "maxbuttons");
    ?>
</strong></p>	
      	
      	<div class="option"><label><?php 
    _e("Field", "maxbuttons");
    ?>
 </label> <?php 
    echo maxUtils::selectify("replace_field", $allfields, 'url');
    ?>
</div>	
      
      	<div class="option"><label><?php 
    _e("Search", "maxbuttons");
    ?>
 </label> <input type="text" name="search" value=""></div>
      	<div class="option"><label><?php 
    _e("Replace", "maxbuttons");
    ?>
 </label> <input type="text" name="replace" value=""></div>
      	
    
    	<p style="color: #ff0000"> <?php 
    _e("I understand that this may destroy all my buttons", "maxbuttons");
    function admin_fields()
    {
        extract($this->data);
        $orientation_array = array("auto" => __("Auto", "maxbuttons"), "horizontal" => __("Horizontal", "maxbuttons"), "vertical" => __("Vertical", "maxbuttons"));
        $staticposver = array("auto" => __("Auto", "maxbuttons"), "center" => __("Center", "maxbuttons"), "top" => __("Top", "maxbuttons"), "bottom" => __("Bottom", "maxbuttons"));
        $staticposhor = array("auto" => __("Auto", "maxbuttons"), "center" => __("Center", "maxbutton-pro"), "left" => __("Left", "maxbuttons"), "right" => __("Right", "maxbuttons"));
        $px = __("px", "maxbuttons");
        ?>
<div class="mb_tab option-container layout-block" data-options="layout"> 
	<div class="title">
		<span class="dashicons dashicons-admin-appearance"></span>
		<span class="title"><?php 
        _e("Layout", "maxbuttons");
        ?>
</span>
	    <span class='manual-box'><a class='manual-toggle' data-target="layout"> <?php 
        _e("Getting Started", "maxbuttons-pro");
        ?>
 </a></span> 
		<span class='right'><button name="save" type="submit"  data-form='collection_edit' class="button button-primary"><?php 
        _e("Save All", "maxbuttons");
        ?>
</button>
		</span>		
	</div>
	
	<div class="inside"> 
		<div class="option"> 
			<label for="margin-left"><?php 
        _e("Margin left", "maxbuttons");
        ?>
</label>
			<input type="number" class="tiny-nopad" id="margin_left" name="margin_left" value="<?php 
        echo intval($margin_left);
        ?>
" class="tiny"> <?php 
        echo $px;
        ?>
		</div>

		<div class="option"> 
			<label for="margin-right"><?php 
        _e("Margin right", "maxbuttons");
        ?>
</label>
			<input type="number" name="margin_right" id="margin_right" value="<?php 
        echo intval($margin_right);
        ?>
" class="tiny"> <?php 
        echo $px;
        ?>
		</div>

		<div class="option"> 
			<label for="margin-top"><?php 
        _e("Margin bottom", "maxbuttons");
        ?>
</label>
			<input type="number" name="margin_bottom" id="margin_bottom" value="<?php 
        echo maxUtils::strip_px($margin_top);
        ?>
" class="tiny"> <?php 
        echo $px;
        ?>
		</div>
		
		<div class="option"> 
			<label for="margin-bottom"><?php 
        _e("Margin top", "maxbuttons");
        ?>
</label>
			<input type="number" name="margin_top" id="margin_top" value="<?php 
        echo maxUtils::strip_px($margin_bottom);
        ?>
" class="tiny"> <?php 
        echo $px;
        ?>
		</div>						

		<div class="option"> 
			<label for="orientation"><?php 
        _e("Orientation", "maxbuttons");
        ?>
</label>
			<?php 
        echo maxUtils::selectify("orientation", $orientation_array, $orientation);
        ?>
		</div>
		
		<div class="option"> 
			<label for="item_margin_right"><?php 
        _e("Item margin right", "maxbuttons");
        ?>
</label>
			<input type="number" name="item_margin_right" id="item_margin_right" value="<?php 
        echo maxUtils::strip_px($item_margin_right);
        ?>
"> <?php 
        echo $px;
        ?>
		</div>
		
		<div class="option"> 
			<label for="item_margin_bottom"><?php 
        _e("Item margin bottom", "maxbuttons");
        ?>
</label>
			<input type="number" name="item_margin_bottom" id="item_margin_bottom" value="<?php 
        echo maxUtils::strip_px($item_margin_bottom);
        ?>
"> 
				<?php 
        echo $px;
        ?>
 
 
		</div>
		
		<div class="option"> 
			<label for="ignore_container"><?php 
        _e("Remove container width and margins", "maxbuttons");
        ?>
</label>
			<input type="checkbox" name="ignore_container" value="1" <?php 
        checked($ignore_container, 1);
        ?>
>
			<div class="help fa fa-question-circle "> 
			<span><?php 
        _e("Removes the margins and widths of the button container.", "maxbuttons");
        ?>
 
				</span>
			</div>
						
		</div>
	</div>
	
	<?php 
        $condition = array("target" => "placement", "values" => array("static-left", "static-right", "static-top", "static-bottom"));
        $static_conditional = htmlentities(json_encode($condition));
        ?>
	<div class='conditional-option' data-show="<?php 
        echo $static_conditional;
        ?>
">
		<div class="title"><span class="dashicons dashicons-admin-appearance"></span> <?php 
        _e("Static positioning", "maxbuttons");
        ?>
</div>		
		<div class="inside"> 
	<?php 
        $condition = array("target" => "placement", "values" => array("static-left", "static-right"));
        $static_conditional = htmlentities(json_encode($condition));
        ?>
			<div class="option conditional-option" data-show="<?php 
        echo $static_conditional;
        ?>
"> 
				<label for="static_position_ver"><?php 
        _e("Static position vertical", "maxbuttons");
        ?>
</label>
				<?php 
        echo maxUtils::selectify("static_position_ver", $staticposver, $static_position_ver);
        ?>
		
			</div>
		<?php 
        $condition = array("target" => "placement", "values" => array("static-top", "static-bottom"));
        $static_conditional = htmlentities(json_encode($condition));
        ?>
	
			<div class="option conditional-option" data-show="<?php 
        echo $static_conditional;
        ?>
"> 
				<label for="static_position_hor"><?php 
        _e("Static position horizontal", "maxbuttons");
        ?>
</label>
				<?php 
        echo maxUtils::selectify("static_position_hor", $staticposhor, $static_position_hor);
        ?>
		
			</div>
		</div>
	</div>
	<!-- manual entry -->
	<div class="manual-entry" data-manual="layout"> 	
		<h3><?php 
        _e("Layout settings", "maxbuttons");
        ?>
			 <span class="dashicons dashicons-no window close manual-toggle" data-target="layout"></span>  
		</h3>
						
		<p><?php 
        _e("The first 4 options - margins left, right, buttom and top - are for positioning the entire collection.  Click the Preview tab on so you can see the changes to your collection as you make them.  The Orientation options let’s you choose between Auto, Horizontal and Vertical. Image margin allows you to set the spacing between the icons.", "maxbuttons");
        ?>
</p>
	
	</div>	
</div> <!-- tab --> 
		
	<?php 
    }
    function admin_fields()
    {
        extract($this->data);
        // admin data
        $placement_options = array("after" => __("After", "maxbuttons"), "before" => __("Before", "maxbuttons"), "after-before" => __("Before + After (both)", "maxbuttons"), "static-left" => __("Static left", "maxbuttons"), "static-right" => __("Static right", "maxbuttons"), "static-top" => __("Static top", "maxbuttons"), "static-bottom" => __("Static bottom", "maxbuttons"));
        ?>
<div class="mb_tab option-container" data-options="settings"> 
	<div class="title">
		<span class="dashicons dashicons-admin-settings"></span> 
		<span class="title"><?php 
        _e("Settings", "maxbuttons");
        ?>
</span>
		  <span class='manual-box'><a class='manual-toggle' data-target="settings"> <?php 
        _e("Getting Started", "maxbuttons-pro");
        ?>
 </a></span> 
		<span class='right'><button name="save" type="submit"  data-form='collection_edit' class="button button-primary"><?php 
        _e("Save All", "maxbuttons");
        ?>
</button>
		</span>
	</div>
	
	<div class="inside"> 
		
		<div class="option">
			<label for="collection_name"><?php 
        _e("Name");
        ?>
</label>
			<input type="text" id='collection_name' name="name" value="<?php 
        echo esc_attr($name);
        ?>
" /> 
			<div class="help fa fa-question-circle"> 
				<span><?php 
        _e("The name of your collection. It will not be displayed on the site.", "maxbuttons");
        ?>
				</span>
			</div>
						
		</div>
		
		<div class="option"> 
			<label for="collection_show"><?php 
        _e("Automatically show on", "maxbuttons");
        ?>
</label>
			
			<div class='option-list'>
				<div class="help fa fa-question-circle"> 
					<span><?php 
        _e("Auto-display your buttons on the site. Checking the options will display the buttons on the corresponding part.", "maxbuttons");
        ?>
					</span>
				</div>			
				<input type="checkbox" name="show_homepage" value="1" <?php 
        checked(1, $show_homepage);
        ?>
 >  
					<?php 
        _e("Homepage", "maxbuttons");
        ?>
<br /> 
					
				<input type="checkbox" name="show_page" value="1" <?php 
        checked(1, $show_page);
        ?>
 > <?php 
        _e("Pages", "maxbuttons");
        ?>
<br>
				<input type="checkbox" name="show_post" value="1" <?php 
        checked(1, $show_post);
        ?>
 >  <?php 
        _e("Posts", "maxbuttons");
        ?>
<br>				
				<input type="checkbox" name="show_archive" value="1" <?php 
        checked(1, $show_archive);
        ?>
 > 
					<?php 
        _e("Category / Archives", "maxbuttons");
        ?>
 <br>
					
			
			</div>
		</div>
		
		<div class="option"> 
			<label for="collection_placement"><?php 
        _e("Placement");
        ?>
</label>
			<?php 
        echo maxUtils::selectify("placement", $placement_options, $placement);
        ?>
				<div class="help fa fa-question-circle"> 
					<span><?php 
        _e("Choose where the buttons will show up.", "maxbuttons");
        ?>
					</span>
				</div>	
		</div>
		
		
		
	</div>
</div> <!-- option container --> 

	<div class="manual-entry" data-manual="settings"> 	
		<h3><?php 
        _e("General settings", "maxbuttons");
        ?>
			 <span class="dashicons dashicons-no window close manual-toggle" data-target="settings"></span>  
		</h3>
						
		<p><?php 
        _e("Give a name to your collection of buttons and select which portions and locations on your site you want the collection to appear.  Anytime you want to see how your collection is going to look click the Preview tab to open up the Preview tab.  We suggest you do this first. ", "maxbuttons");
        ?>
</p>
		

	</div>
	
	
	<?php 
    }
    function do_social_option($button_id, $data, $button_array = array())
    {
        global $supported_networks, $share_url_settings;
        extract($data);
        $index = $data["index"];
        $button = MB()->getClass("button");
        if ($button_id > 0 && (!isset($button_array["meta"]) || !$button_array["meta"]["is_virtual"])) {
            $button->set($button_id);
        } elseif (count($button_array) > 0) {
            $button_array["name"] = $button_array["basic"]["name"];
            $button_array["status"] = $button_array["basic"]["status"];
            $button->clear();
            maxButtons::buttonLoad(array("button_id" => $button_id));
            // central registration - from button
            $button->setupData($button_array);
        }
        $document_id = $button->getDocumentID();
        ?>
	<div class="social-option" data-id="<?php 
        echo $button_id;
        ?>
" data-document_id="<?php 
        echo $document_id;
        ?>
"> 
		<input type="hidden" name="social-option[]" value="<?php 
        echo $button_id;
        ?>
" /> 
		<div class="option"> 
			<div class="shortcode-container">
			<?php 
        $button->display(array("mode" => "preview"));
        ?>

			</div>
					<span class="button_name"><?php 
        echo $button->getName();
        ?>
</span>
		</div>
		
		
		<div class="option  "> 
			<label><?php 
        _e("Sharing network", "maxbuttons");
        ?>
</label>
			<?php 
        echo maxUtils::selectify("network-{$button_id}-{$index}", $supported_networks, $network, 'network');
        ?>
 
			
		</div>
		
		<div class="option conditional-option"  data-show="<?php 
        echo $this->do_supports('display_count', $button_id, $index);
        ?>
"> 
			<label><?php 
        _e("Show Share Counts", "maxbuttons");
        ?>
</label>
			<input type="checkbox" name="display_count-<?php 
        echo $button_id;
        ?>
-<?php 
        echo $index;
        ?>
" value="1" <?php 
        checked($display_count, 1);
        ?>
  /> 
		</div>
		
		<div class="option conditional-option"  data-show="<?php 
        echo $this->do_supports('count_threshold', $button_id, $index);
        ?>
"> 
			<label><?php 
        _e("Minimum share count", "maxbuttons");
        ?>
</label>
			<input type="number" name="count_threshold-<?php 
        echo $button_id;
        ?>
-<?php 
        echo $index;
        ?>
" min="0" 
			value="<?php 
        echo intval($count_threshold);
        ?>
" />  
		</div>	

		<div class="option conditional-option"  data-show="<?php 
        echo $this->do_supports('share_url_setting', $button_id, $index);
        ?>
"> 
			<label><?php 
        _e("Share URL settings", "maxbuttons");
        ?>
</label>
			<?php 
        echo maxUtils::selectify("share_url_setting-{$button_id}-{$index}", $share_url_settings, $share_url_setting);
        ?>
			 

			<div class="help fa fa-question-circle "> 
			<span><?php 
        _e("Which URL (link) is to be shared. Auto will share the current page on pages, and the full site URL on the homepage", "maxbuttons");
        ?>
 
				</span>
			</div>
				
		</div>	
		
		<!-- bloglovin --> 
		<div class="option conditional-option"  data-show="<?php 
        echo $this->do_supports('blog_url', $button_id, $index);
        ?>
"> 
			<label><?php 
        _e("Bloglovin' Blog URL", "maxbuttons");
        ?>
</label>
			<input type="text" name="blog_url-<?php 
        echo $button_id;
        ?>
-<?php 
        echo $index;
        ?>
"
				 value="<?php 
        echo esc_attr($blog_url);
        ?>
"> 
		</div>
		
	<?php 
        $condition = array("target" => "share_url_setting-{$button_id}-{$index}", "values" => array("custom-url"));
        $custom_conditional = htmlentities(json_encode($condition));
        ?>
	
			
  		
		<div class="option conditional-option" data-show="<?php 
        echo $custom_conditional;
        ?>
">	
			<label><?php 
        _e("Custom URL", "maxbuttons");
        ?>
</label> 
			<input type="text" name="share_url_custom-<?php 
        echo $button_id;
        ?>
-<?php 
        echo $index;
        ?>
"
			 value="<?php 
        echo esc_attr($share_url_custom);
        ?>
"> 
  
		</div>
	</div> <!-- social option --> 
		<?php 
    }
    public function admin_fields()
    {
        $data = $this->data[$this->blockname];
        $media_names = maxUtils::get_media_query(1);
        // nicenames
        $media_desc = maxUtils::get_media_query(3);
        $units = array("px" => __("px", "maxbuttons"), "%" => __("%", "maxbuttons"));
        $container_floats = array("" => "", "none" => __("None", "maxbuttons"), "left" => __("Left", "maxbuttons"), "right" => __("Right", "maxbuttons"));
        foreach ($this->fields as $field => $options) {
            $default = isset($options["default"]) ? $options["default"] : '';
            ${$field} = isset($data[$field]) ? $data[$field] : $default;
            ${$field . "_default"} = $default;
        }
        // sorting routine via array merge.
        $fk = array_flip(array_keys($media_query));
        $names_used = array_intersect_key($media_names, $fk);
        $media_query = array_merge($names_used, $media_query);
        ?>
			<div class="mb_tab option-container">
				<div class="title"><?php 
        _e('Responsive Settings', 'maxbuttons');
        ?>
</div>
				<div class="inside">

					<div class="option-design"> 
						<p class="note"><?php 
        _e("Responsive settings let you decide the behavior of the button on different devices and screen sizes. For instance large buttons on small screens.", "maxbuttons");
        ?>
</p>	
						<div class="label"><?php 
        _e("Auto Responsive", 'maxbuttons');
        ?>
 <?php 
        _e("(Experimental)", "maxbuttons");
        ?>
</div>

						<div class="input"> 
							<input type='checkbox' name='auto_responsive' value='1' <?php 
        checked(1, $auto_responsive);
        ?>
 >
						</div>

											<div class="clear"></div>
						<p class="note"><strong><?php 
        _e("Note:", "maxbuttons");
        ?>
 </strong><?php 
        _e(" Auto responsive settings will take a guess only on small screens. To control your responsive settings uncheck this button. This will show more options.", "maxbuttons");
        ?>
</p>	
					</div>
 
					
				<div class='option-design media_queries_options'>
					<?php 
        $i = 0;
        foreach ($media_query as $item => $data) {
            foreach ($data as $index => $fields) {
                ?>
						<div class='media_query'> 
							<span class='removebutton'><img src="<?php 
                echo MB()->get_plugin_url();
                ?>
/assets/icons/remove.png"></span>
							
							<input type="hidden" name="media_query[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo $item;
                ?>
"> 
							<label class='title'><?php 
                echo $media_names[$item];
                ?>
</label>
							<p class='description'><?php 
                echo $media_desc[$item];
                ?>
</p>							
							<?php 
                if ($item == "custom") {
                    $custom_class = '';
                } else {
                    $custom_class = 'hidden';
                }
                ?>
							<div class="custom" <?php 
                echo $custom_class;
                ?>
 > 
								<div class="label"><?php 
                _e("Min width", "maxbuttons");
                ?>
</div>								
								<div class="input"><input type="text" class="tiny" name="mq_custom_minwidth[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo $fields["mq_custom_minwidth"];
                ?>
" />px</div> 
								
								<div class="label max"> <?php 
                _e("Max width", "maxbuttons");
                ?>
</div>
								<div class="input max"><input type="text" class="tiny" name="mq_custom_maxwidth[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo $fields["mq_custom_maxwidth"];
                ?>
" />px</div> 

								
							</div>	
						
							<div class='label'><?php 
                _e("Font size", "maxbuttons");
                ?>
</div>
							<div class='input'><input type='text' name='mq_font_size[<?php 
                echo $i;
                ?>
]' class='tiny' value="<?php 
                echo $fields["mq_font_size"];
                ?>
"> <?php 
                echo maxUtils::selectify("mq_font_size_unit[{$i}]", $units, $fields["mq_font_size_unit"]);
                ?>
							</div>	
						
							<div class='label'><?php 
                _e("Button width", 'maxbuttons');
                ?>
</div>
							
							<div class='input'><input type='text' name="mq_button_width[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo $fields["mq_button_width"];
                ?>
" class='tiny'> <?php 
                echo maxUtils::selectify("mq_button_width_unit[{$i}]", $units, $fields["mq_button_width_unit"]);
                ?>
</div>
							
							<div class='label'><?php 
                _e("Container width", 'maxbuttons');
                ?>
</div>
							
							<div class='input'><input type='text' name="mq_container_width[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo $fields["mq_container_width"];
                ?>
" class='tiny'> <?php 
                echo maxUtils::selectify("mq_container_width_unit[{$i}]", $units, $fields["mq_container_width_unit"]);
                ?>
							</div>
							
							<div class='label'><?php 
                _e("Container float", "maxbuttons");
                ?>
</div>
							<div class="input"><?php 
                echo maxUtils::selectify("mq_container_float[{$i}]", $container_floats, $fields["mq_container_float"]);
                ?>
</div>
							
							<?php 
                $mq_hide = isset($fields["mq_hide"]) ? $fields["mq_hide"] : '';
                ?>
							<div class="label"><?php 
                _e("Hide button on this view", "maxbuttons");
                ?>
</div>
							<div class="input">
 
								<input type="checkbox" name="mq_hide[<?php 
                echo $i;
                ?>
]" value="none" <?php 
                checked('none', $mq_hide);
                ?>
 ></div>
							
								
						</div>
					 
						<?php 
                $i++;
                if ($item != 'custom') {
                    unset($media_names[$item]);
                }
                // remove existing queries from new query selection
            }
        }
        ?>

					<div class="new_query_space"></div>
					<div class="clear"></div>					
					<div class="option-design new-query">
						<div class="label"><?php 
        _e('New Query', 'maxbuttons');
        ?>
</div>
						
 
						<div class="input">
							<?php 
        echo maxUtils::selectify("new_query", $media_names, '');
        ?>
							<a class="button add_media_query"><?php 
        _e("Add", "maxbuttons");
        ?>
</a>
						</div>
						
 
						<div class="clear"></div>
					</div>
				 </div>		
			</div> <!-- inside --> 
		
			<input type="hidden" name="next_media_index" value="<?php 
        echo $i;
        ?>
" >
			<div class='media_option_prot'>

				<div class='media_query'> 
							<span class='removebutton'><img src="<?php 
        echo MB()->get_plugin_url();
        ?>
assets/icons/remove.png"></span>

							<input type="hidden" name="media_query[]" value=""> 
							<label class='title'></label>
							<p class='description'>Description here</p>
							
							<div class="custom"> 
								<div class="label"><?php 
        _e("Min width", "maxbuttons");
        ?>
</div>								
								<div class="input"><input type="text" class="tiny" name="mq_custom_minwidth[]" value="0" />px</div> 
								
								<div class="label max"> <?php 
        _e("Max width", "maxbuttons");
        ?>
</div>
								<div class="input max"><input type="text" class="tiny" name="mq_custom_maxwidth[]" value="0" />px</div> 

								
							</div>	
							<div class='label'><?php 
        _e("Font size", "maxbuttons");
        ?>
</div>
							<div class='input'><input type='text' name='mq_font_size[]' class='tiny' value="90"> <?php 
        echo maxUtils::selectify("mq_font_size_unit[]", $units, "%");
        ?>
							</div>	
												
							<div class='label'><?php 
        _e("Button width", "maxbuttons");
        ?>
</div>
							<div class='input'><input type='text' name="mq_button_width[]" value="0" class='tiny'> <?php 
        echo maxUtils::selectify("mq_button_width_unit[]", $units, "");
        ?>
</div>
							<div class='label'><?php 
        _e("Container width", "maxbuttons");
        ?>
</div>
							<div class='input'>
							<input type='text' name="mq_container_width[]" value="0" class='tiny'> <?php 
        echo maxUtils::selectify("mq_container_width_unit[]", $units, "");
        ?>
							</div>

							<div class='label'><?php 
        _e("Container float", "maxbuttons");
        ?>
</div>
							<div class="input"><?php 
        echo maxUtils::selectify("mq_container_float[]", $container_floats, "");
        ?>
</div>
							<div class="label"><?php 
        _e("Hide button on this view", "maxbuttons");
        ?>
</div>
							<div class="input"><input type="checkbox" name="mq_hide[]" value="none">
							</div>								
				`</div>

			</div>
			<div id="media_desc">
			<?php 
        foreach ($media_desc as $key => $desc) {
            echo "<span id='{$key}'>{$desc}</span>";
        }
        ?>
			</div>
			

		</div> <!-- container --> 
		
				

			
<?php 
    }