Exemple #1
0
function Update($Tipo = null)
{
    if ($Tipo == null or strtolower($Tipo) == strtolower("Saldos")) {
        @($dados = MB("getInfo"));
        if ($dados["success"] == 0) {
            echo $dados["error"];
        } elseif (!is_null($dados)) {
            $_SESSION["Temp"]["Saldos"] = $dados["return"]["funds"];
        }
    }
    if ($Tipo == null or $Tipo == "MyOrdens") {
        @($dados = MB("OrderList&pair=btc_brl&status=active"));
        if ($dados["success"] == 0) {
            echo $dados["error"];
        } elseif (!is_null($dados)) {
            $_SESSION["Temp"]["btc"]["MyOrdens"] = $dados["return"];
        }
        @($dados = MB("OrderList&pair=ltc_brl&status=active"));
        if ($dados["success"] == 0) {
            echo $dados["error"];
        } elseif (!is_null($dados)) {
            $_SESSION["Temp"]["ltc"]["MyOrdens"] = $dados["return"];
        }
    }
}
 protected function compile($css)
 {
     $scss = new scssc();
     $scss->setImportPaths(MB()->get_plugin_path() . "assets/scss");
     $minify = get_option("maxbuttons_minify", 1);
     if ($minify == 1) {
         $scss->setFormatter('scss_formatter_compressed');
     }
     $compile = " @import '_mixins.scss';  " . $css;
     //maxUtils::addTime("CSSParser: Compile start ");
     try {
         $css = $scss->compile($compile);
     } catch (Exception $e) {
         $css = $this->output_css;
     }
     //maxUtils::addTime("CSSParser: Compile end ");
     return $css;
 }
 public function parse_pack_button($xmlbutton)
 {
     $button = MB()->getClass("button");
     if (count($xmlbutton->attributes()) > 0) {
         $attrs = current($xmlbutton->attributes());
         $data = MB()->getClass("install")->convertOldFields($attrs);
         $button_array = array();
         $button_array["status"] = $data["status"];
         $data = $button->save($data, false);
         // convert from post var to block struct without dbase save
         foreach ($data as $block => $values) {
             if (is_array($values)) {
                 $button_array[$block] = json_encode($values);
             } else {
                 $button_array[$block] = $values;
             }
         }
     } else {
         //$button = MB()->getClass("button");
         $button_array = json_decode(json_encode((array) $xmlbutton), TRUE);
         //	$data = $button->save($button_array, false);
     }
     $temp_id = floor(rand(100000, 990000));
     $button_array["id"] = $temp_id;
     // fingers crossed
     // icons from pack
     $icon_array = array();
     if (isset($button_array["icon"])) {
         $icon_array = maybe_unserialize($button_array["icon"]);
         if (!is_array($icon_array)) {
             // moving to json_encode
             $icon_array = json_decode($button_array["icon"], true);
         }
     }
     if (isset($icon_array["icon_url"]) && $icon_array["icon_url"] != '') {
         $path = str_replace(array('http:', 'https:'), '', $this->pack_path);
         // allow for SSL / HTTP
         $icon_array["icon_url"] = $path . $icon_array["icon_url"];
         // pack path to allow for remote images
         $button_array["icon"] = json_encode($icon_array);
     }
     return $button_array;
 }
Exemple #4
0
                '&tipo='+document.ordem.tipo.value+
                '&valor='+document.ordem.valor.value+
                '&volume='+document.ordem.volume.value);"><br>
            <span id="AjaxSave"></span>
        </form><br><?php 
    } elseif ($_GET["Action"] == "New") {
        $dados = MB("Trade&pair=" . $_POST["pair"] . "_brl&type=" . $_POST["tipo"] . "&volume=" . str_replace(",", ".", $_POST["volume"]) . "&price=" . str_replace(",", ".", $_POST["valor"]));
        if ($dados["success"]) {
            echo "Ordem criada com êxito";
        } else {
            echo $dados["error"];
        }
        ?>
<br><?php 
    } elseif ($_GET["Action"] == "Del") {
        $dados = MB("CancelOrder&pair=" . $_GET["pair"] . "_brl&order_id=" . $_GET["id"]);
        if ($dados["success"]) {
            echo "Ordem excluída com êxito<br>";
        } else {
            echo $dados["error"];
        }
        ?>
        <a href="#" onclick="Ajax('ordens.php?pair=<?php 
        echo $_GET["pair"];
        ?>
','AjaxOrdens',null,true);
            Ajax('index.php?Action=Saldo','AjaxSaldo',null,true);">Atualizar</a><?php 
    }
} else {
    Update("MyOrdens");
    $_SESSION["Temp"]["Auto"] = array();
<?php

//$classes = array();
//if( !empty($instance['design']['hover']) )
//$classes[] = 'ow-button-hover';
//print_R($instance);
// [id] => 29 [text] => [url] => [new_window] => [_sow_form_id] => 5641e358d8cc6 [is_preview] => 1
$button_class = MB()->getClass('button');
$args = array();
if (isset($instance["is_preview"]) && $instance["is_preview"]) {
    $args["load_css"] = 'inline';
}
$button_class->shortcode($instance);
$button_class->display($args);
return;
?>

<div class="ow-maxbutton-width">


	<?php 
$button_attributes = array('class' => esc_attr(implode(' ', $classes)));
if (!empty($instance['new_window'])) {
    $button_attributes['target'] = '_blank';
}
if (!empty($instance['url'])) {
    $button_attributes['href'] = sow_esc_url($instance['url']);
}
if (!empty($instance['attributes']['id'])) {
    $button_attributes['id'] = esc_attr($instance['attributes']['id']);
}
 function log($action, $message)
 {
     if (!defined('MAXBUTTONS_DEBUG') || !MAXBUTTONS_DEBUG) {
         return;
     }
     $stack = debug_backtrace();
     $caller = $stack[1]['function'];
     $dir = MB()->get_plugin_path() . "logs";
     if (!is_dir($dir)) {
         @mkdir($dir, 0777, true);
     }
     // silently fail here.
     if (!is_dir($dir)) {
         return false;
     }
     $file = fopen($dir . "/maxbuttons.log", "a+");
     $now = new DateTime();
     $now_format = $now->format("d/M/Y H:i:s");
     $write_string = "[" . $now_format . "] {$action} - {$message} ( {$caller} )";
     fwrite($file, $write_string);
     fclose($file);
 }
    static function display_pagination($page_args)
    {
        $mbadmin = MB()->getClass("admin");
        $pag = $mbadmin->getButtonPages($page_args);
        if ($pag["first"] == $pag["last"]) {
            return;
        }
        extract($pag);
        ?>

	<div class="tablenav-pages"><span class="displaying-num"><?php 
        echo $pag["total"];
        ?>
 items</span>
	<span class="pagination-links">
	<a href="<?php 
        echo $first_url;
        ?>
" title="<?php 
        _e("Go to the first page", "maxbuttons");
        ?>
" class="first-page <?php 
        if (!$first_url) {
            echo "disabled";
        }
        ?>
">«</a>

	<a href="<?php 
        echo $prev_url;
        ?>
" title="<?php 
        _e("Go to the previous page", "maxbuttons");
        ?>
" class="prev-page <?php 
        if (!$prev_url) {
            echo "disabled";
        }
        ?>
">‹</a>

	<span class="paging-input"><input data-url="<?php 
        echo $base;
        ?>
" class='input-paging' min="1" max="<?php 
        echo $last;
        ?>
" type="number" name='paging-number' size="1" value="<?php 
        echo $current;
        ?>
"> <?php 
        _e("of", "maxbuttons");
        ?>
 <span class="total-pages"><?php 
        echo $last;
        ?>
	</span></span>
	<a href="<?php 
        echo $next_url;
        ?>
" title="<?php 
        _e("Go to the next page", "maxbuttons");
        ?>
" class="next-page <?php 
        if (!$next_url) {
            echo "disabled";
        }
        ?>
">›</a>

	<a href="<?php 
        echo $last_url;
        ?>
" title="<?php 
        _e("Go to the last page", "maxbuttons");
        ?>
" class="last-page <?php 
        if (!$last_url) {
            echo "disabled";
        }
        ?>
">»</a></span></div>
 
	<?php 
    }
 public function update($data)
 {
     global $wpdb;
     $return = false;
     $fields = array();
     foreach ($this->blocks as $block) {
         if (isset($data[$block])) {
             $blockData = $data[$block];
             $fields[$block] = json_encode($blockData);
         }
     }
     if (isset($data["name"])) {
         // other fields.
         $fields["name"] = $data["name"];
     }
     if (isset($data["status"])) {
         $fields["status"] = $data["status"];
     }
     $where = array('id' => $this->id);
     if ($this->id > 0) {
         $where = array('id' => $this->id);
         $where_format = array('%d');
         $result = $wpdb->update(maxUtils::get_buttons_table_name(), $fields, $where, null, $where_format);
         $return = true;
     } else {
         $result = $wpdb->insert(maxUtils::get_buttons_table_name(), $fields);
         $id = $wpdb->insert_id;
         $this->id = $id;
         $return = $id;
     }
     if ($result === 0) {
         $error = "Database error " . $wpdb->last_error;
         MB()->add_notice('error', $error);
     }
     // update the cache
     //$css = $this->parse_css('normal', true); // force compile
     $this->cache = '';
     // empty cache
     $result = $this->set($this->id);
     // set the newest values
     if (!$result) {
         return false;
     }
     $this->display(array("echo" => false, "load_css" => "element"));
     // do display routing to compile.
     $css = $this->parsed_css;
     $this->update_cache($css);
     return $return;
 }
    function admin_fields()
    {
        extract($this->data);
        // admin data
        $btns = $this->collection->editor_getPacks();
        ?>
	
	<?php 
        ob_start();
        ?>
 
	<div id="picker-back"></div>
	<div id="picker-modal" class="max-modal"> 
 
			<div class="modal_header"> 
				<h3 class='title'><?php 
        _e("Select your buttons", "maxbuttons");
        ?>
</h3>
				<div  class="modal_close tb-close-icon"></div>
			</div>
			
			<div class='picker-packages'> 
 
				<ul>
				<?php 
        foreach ($btns as $index => $data) {
            ?>
					<li><a href="#" data-pack="<?php 
            echo $index;
            ?>
"><?php 
            echo $data["tab"];
            ?>
</a></li>
				
				<?php 
        }
        ?>
				</ul>
			</div>
			<div class='picker-main' >
			
			
			</div>
			<div class='picker-inselection'> 
				<div class='info'>
					<span class='count'></span> <?php 
        _e("Selected", "maxbuttons");
        ?>
					<button type="button" name="clear" class='button-link clear-selection'><?php 
        _e("Clear", "maxbuttons");
        ?>
</button>
				</div>
				<div class='items'>
				</div>
				<div class='add'> 
					<button type="button" name="add-buttons" class="button button-primary"><?php 
        _e("Add selected buttons", "maxbuttons");
        ?>
</button>
				</div>
			</div>
		
		
	</div>	
	
	<?php 
        global $mb_pick_modal;
        $mb_pick_modal = ob_get_contents();
        // print this outside of the main div since it messes with z-index
        add_action('mb-interface-end', 'mb_print_modal');
        function mb_print_modal()
        {
            global $mb_pick_modal;
            echo $mb_pick_modal;
        }
        ob_end_clean();
        ?>
	<div class="mb_tab option-container">
		<div class="title">
			<span class="dashicons dashicons-list-view"></span> 
			<span class='title'><?php 
        _e("Buttons", "maxbuttons");
        ?>
</span>
			<button name="picker_popup" type="button" class="button"><?php 
        _e("Add buttons", "maxbuttons");
        ?>
</button>
			<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 preview_collection">
			<label> <?php 
        _e("Current Selection", "maxbuttons");
        ?>
</label>
			<p><?php 
        _e("Drag the buttons to change the order of your selection. You can remove the button by clicking on the remove icon.", "maxbuttons");
        ?>
 
			</p>

			
			<div class="mb_collection_selection"> 
				<input type="hidden" name="sorted" value="" /> 
				<input type="hidden" name="previous_selection" value="" /> 

				<div class="sortable buttons">
 
					<?php 
        foreach ($selection as $button_id) {
            echo "<div class='shortcode-container item' data-id='{$button_id}'>";
            $button = MB()->getClass("button");
            $button->set($button_id);
            echo "<div id='maxbutton-{$button_id}'>";
            $button->display(array("load_css" => "inline"));
            echo "</div>";
            echo "<div class='button-remove'><span class='dashicons dashicons-no'></span></div>";
            echo "</div>";
        }
        ?>
 
				</div>
			</div>
	    </div>  <!-- option --> 
	</div> <!-- inside --> 
</div> <!-- tab -->
	
	<?php 
    }
Exemple #10
0
    public function admin_fields()
    {
        $data = $this->data[$this->blockname];
        $media_names = maxButtonsUtils::get_media_query(1);
        // nicenames
        $media_desc = maxButtonsUtils::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="option-container">
				<div class="title"><?php 
        _e('Responsive Settings', 'maxbuttons');
        ?>
</div>
				<div class="inside">
					<p><?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="option-design"> 
						<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><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 
        foreach ($media_query as $item => $data) {
            foreach ($data as $index => $fields) {
                ?>
						<div class='media_query'> 
							<span class='removebutton'><img src="<?php 
                echo maxButtons::get_plugin_url();
                ?>
/assets/icons/remove.png"></span>
							
							<input type="hidden" name="media_query[]" 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[]" 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[]" 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[]' class='tiny' value="<?php 
                echo $fields["mq_font_size"];
                ?>
"> <?php 
                echo maxButtonsUtils::selectify("mq_font_size_unit[]", $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[]" value="<?php 
                echo $fields["mq_button_width"];
                ?>
" class='tiny'> <?php 
                echo maxButtonsUtils::selectify("mq_button_width_unit[]", $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[]" value="<?php 
                echo $fields["mq_container_width"];
                ?>
" class='tiny'> <?php 
                echo maxButtonsUtils::selectify("mq_container_width_unit[]", $units, $fields["mq_container_width_unit"]);
                ?>
							</div>
							
							<div class='label'><?php 
                _e("Container float", "maxbuttons");
                ?>
</div>
							<div class="input"><?php 
                echo maxButtonsUtils::selectify("mq_container_float[]", $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[]" value="none" <?php 
                checked('none', $mq_hide);
                ?>
 ></div>
							
								
						</div>
					 
						<?php 
                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 maxButtonsUtils::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 --> 
		
			<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 maxButtonsUtils::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 maxButtonsUtils::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 maxButtonsUtils::selectify("mq_container_width_unit[]", $units, "");
        ?>
							</div>

							<div class='label'><?php 
        _e("Container float", "maxbuttons");
        ?>
</div>
							<div class="input"><?php 
        echo maxButtonsUtils::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 
    }
<?php

$plugin_url = MB()->get_plugin_url();
$admin = MB()->getClass('admin');
$page_title = __("Upgrade to Pro", "maxbuttons");
$action = '<a class="page-title-action add-new-h2" href="https://maxbuttons.com/pricing/?utm_source=mbf-dashboard&utm_medium=mbf-plugin&utm_content=mpb-list-sidebar-21&utm_campaign=inthecart19" target="_blank">' . __("Buy Now", "maxbuttons") . "</a>";
$admin->get_header(array("title" => $page_title, "title_action" => $action));
?>
		
		<div class="pro-offer">
			<h2><?php 
_e('Upgrade to MaxButtons Pro - It\'s Only $19!', 'maxbuttons');
?>
</h2>
			<p><?php 
_e('If you\'ve created at least one button with MaxButtons, then you know what it can do: Unlimited colors. Rounded corners. Gradients. Text shadowing. Box shadowing.', 'maxbuttons');
?>
</p>
			<p><?php 
printf(__('Now you can take your buttons to the next level with %sMaxButtons Pro%s. The Pro version gives you all the CSS3 goodness and so much more:', 'maxbuttons'), '<a href="https://maxbuttons.com/pricing/?utm_source=mbf-dashboard&utm_medium=mbf-plugin&utm_content=mpb-list-sidebar-21&utm_campaign=inthecart19" target="_blank">', '</a>');
?>
</p>
			<ul>
				<li><strong><?php 
_e('Font Awesome Integration', 'maxbuttons');
?>
</strong> - <?php 
_e('Use icons from the most popular icon font set on the web!', 'maxbuttons');
?>
</li>
				<li><strong><?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 
    }
    protected function render_field($value, $instance)
    {
        //$buttons = MB()
        ?>
		<script language="javascript"> 
			function insertSOPageBuilder(id)
			{
				//var element = <?php 
        echo $this->element_name;
        ?>
; 
				var button = jQuery('#mb_media_buttons .maxbutton -' + id).parents('.shortcode-container').children().clone();
				jQuery("#SOP_selected").html(button);
				jQuery('#selected_button').val(id); 
			    tb_remove();
		//		return false; 
				
			}
		</script> 
		 <button class="primary" onClick='maxadmin.clickAddButton(event,"insertSOPageBuilder")'><?php 
        _e("Select a Button");
        ?>
</button>
		<p><?php 
        _e('Selected Button', 'maxbuttons');
        ?>
</p>
 		<div id='SOP_selected'><?php 
        $button = MB()->getClass('button');
        if (intval($value) > 0) {
            $button->set($value);
            $button->display(array('load_css' => 'inline'));
        }
        ?>
 </div> 

		<input type="hidden" id="selected_button" value="<?php 
        echo esc_attr(is_array($value) ? '-1' : $value);
        ?>
" name="<?php 
        echo esc_attr($this->element_name);
        ?>
" class="siteorigin-widget-input" />

		<?php 
    }
 function editor_getButtons($pack, $data)
 {
     $button_array = array();
     $admin = MB()->getClass("admin");
     $button = MB()->getClass("button");
     $paged = isset($data["paged"]) ? $data["paged"] : 1;
     $buttons = $admin->getButtons(array("orderby" => "id", "order" => "DESC", "paged" => $paged, "limit" => 18));
     foreach ($buttons as $btn) {
         $id = $btn["id"];
         $b = MB()->getClass('button');
         $b->clear();
         $b->set($id);
         $button_data = $b->get();
         // exclude auto-generated non-user edited buttons.
         if (!isset($button_data["meta"]["user_edited"]) || ($button_data["meta"]["user_edited"] == true || $button_data["meta"]["created_source"] != "collection")) {
             $button_array[] = $b;
         }
         // the object
     }
     return $button_array;
 }
 static function doDirectInit()
 {
     require_once MB()->get_plugin_path() . "assets/integrations/siteorigins_builder/sitebuilder.php";
 }
				alert("<?php 
    _e('Please select a button.', 'maxbuttons');
    ?>
");
				return;
			}
			
			// Send shortcode to the editor
			window.send_to_editor('[maxbutton id="' + button_id + '"]');
		}
	</script>
	
	<div id="select-maxbutton-container" style="display:none" >
		<div class="wrap">
			<h2 style="line-height: 32px; padding-left: 40px; background: url(<?php 
    echo MB()->get_plugin_url() . 'images/mb-peach-32.png';
    ?>
) no-repeat;">
				<?php 
    _e('Insert Button into Editor', 'maxbuttons');
    ?>
				
			</h2>
			
			
			<p><?php 
    _e('Select a button from the list below to place the button shortcode in the editor.', 'maxbuttons');
    ?>
</p>
			<div id="mb_media_buttons">
				<div class='loading'><?php 
<?php 
$groups = MB()->getClass("groups");
$page_title = __("Button groups", "maxbuttons");
include_once "admin_header.php";
?>


<div> 
<a href=''><?php 
_e("Create new group", "maxbuttons");
?>
 </a>

</div>

<div>

</div>


<?php 
include_once "admin_footer.php";
Exemple #18
0
 function get_footer()
 {
     include_once MB()->get_plugin_path() . "includes/admin_footer.php";
 }
<?php

global $page_title;
$page_title = __("Social Share", "maxbuttons");
$admin = MB()->getClass("admin");
//$action = "<a class='page-title-action add-new-h2' href='" . admin_url() . "admin.php?page=maxbuttons-collections&action=edit&collection=social'>" . __('Add New', 'maxbuttons') . "</a>";
$admin->get_header(array("tabs_active" => true, "title" => $page_title, "title_action" => $action));
$collections = maxCollections::getCollections();
$maxCol = new maxCollection();
?>
 
 <a class="page-title-action " href="<?php 
echo admin_url();
?>
admin.php?page=maxbuttons-collections&action=edit&collection=social">
	<?php 
_e("Add New", "maxbuttons");
?>
</a> 
 
<?php 
do_action("mb_display_notices");
?>
<span class="remove_action_title" style="display:none"><?php 
_e("Removing this collection", "maxbuttons");
?>
</span>
<span class="remove_action_text"  style="display:none"><?php 
_e("Are you sure you want to permanently delete this collection?", "maxbuttons");
?>
</span>
    global $maxbuttons_installed_version;
    global $wpdb;
    $table_name = maxButtonsUtils::get_buttons_table_name();
    $sql = "ALTER TABLE " . $table_name . " CONVERT TO CHARACTER SET utf8";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    $wpdb->query($sql);
    $response = 'CHARSET now utf_8 COLLATE utf8_general_ci';
} else {
    $response = '';
}
if (isset($_POST["reset_cache"])) {
    $button = new maxButton();
    $button->reset_cache();
}
if (isset($_POST["remigrate"])) {
    $install = MB()->getClass("install");
    $install::create_database_table();
    $install::migrate();
}
?>

<div id="maxbuttons">
	<div class="wrap">
 
		
		<h2 class="title"><?php 
_e('MaxButtons: Settings', 'maxbuttons');
?>
</h2>
		
		<div class="logo">
 public function getRemoteShareCount($share_url)
 {
     $count_api = $this->network_data["count_api"];
     if ($count_api == '') {
         return false;
     }
     // no api
     $network = $this->network;
     $timeout = 60;
     // prevent the same requests from running multiple times ( i.e. one page, many collections on same url ) .
     $locked = maxUtils::get_transient('mbcol-shares-' . $network . '-' . $share_url . '-lock');
     if ($locked == true) {
         return 'locked';
     }
     // try again on next refresh.
     //lock out next request while this one is still running.
     maxUtils::set_transient('mbcol-shares-' . $network . '-' . $share_url . '-lock', true, $timeout);
     $count_api = str_replace("{url}", $share_url, $count_api);
     $func = $this->network_data["count_function"];
     $count = $this->{$func}($count_api);
     if (defined('MAXBUTTONS_DEBUG') && MAXBUTTONS_DEBUG) {
         $admin = MB()->getClass("admin");
         $admin->log("Get Remote Share", "Call: {$count_api} - Network : " . $this->network . " - Count: {$count} \n ");
     }
     if ($count !== false) {
         $network = $this->network;
         $check_time = $this->network_data["count_check_time"];
         // set count
         maxUtils::set_transient('mbcol-shares-' . $network . '-' . $share_url, $count, $check_time);
     }
     // remove lock
     maxUtils::delete_transient('mbcol-shares-' . $network . '-' . $share_url . '-lock');
     return $count;
 }
 static function ajax_action($args = array())
 {
     ob_start();
     $defaults = array("ajax_nopriv" => false);
     $args = wp_parse_args($args, $defaults);
     $admin = MB()->getClass('admin');
     $nonce = isset($_POST["nonce"]) ? $_POST["nonce"] : false;
     $block_name = sanitize_text_field($_POST["block_name"]);
     $block_action = sanitize_text_field($_POST["block_action"]);
     $block_data = isset($_POST["block_data"]) ? $_POST["block_data"] : '';
     $action = sanitize_text_field($_POST["action"]);
     $collection_id = intval($_POST["collection_id"]);
     $collection_type = sanitize_text_field($_POST["collection_type"]);
     if (!$args["ajax_nopriv"]) {
         if (!wp_verify_nonce($nonce, $action . "-" . $collection_id)) {
             $result["error"] = true;
             $result["body"] = __("Nonce not verified", "maxbuttons");
             $result["result"] = false;
             $result["title"] = __("Security error", "maxbuttons");
             $result["data"] = array("id" => $collection_id);
             $admin->endAjaxRequest($result);
         }
     }
     $result = array("error" => false, "body" => '', "result" => true, "data" => array(), "new_nonce" => 0);
     $collection = self::getCollection($collection_type);
     $collection->set($collection_id);
     $result = $collection->doBlockAjax($result, $block_name, $block_action, $block_data);
     //ob_end_clean();  // prevent PHP errors from breaking JSON response.
     $admin->endAjaxRequest($result);
     $results = $collection->get_meta($name, 'collection_name');
 }
 static function removeExpiredTrans()
 {
     global $wpdb;
     $table = self::get_coltrans_table_name();
     $sql = "DELETE FROM {$table} WHERE expire <  UNIX_TIMESTAMP(NOW())";
     $return = $wpdb->query($sql);
     if ($return === false) {
         $error = "Database error " . $wpdb->last_error;
         MB()->add_notice('error', $error);
     }
 }
Exemple #24
0
            </tr><?php 
    }
    ?>
    </table><br>
    <table border="1" class="Center">
        <tr>
            <th>Moeda</th>
            <th>Tipo</th>
            <th>Volume</th>
            <th>Valor</th>
            <th>Criação</th>
            <th>Execução (Taxa)</th>
            <th>Total</th>
            <th>Dias</th>
        </tr><?php 
    $dados = MB("OrderList&pair=ltc_brl&status=completed");
    foreach ($dados["return"] as $linha) {
        ?>
            <tr>
                <td style="text-align:center;">LCT</td>
                <td><?php 
        echo $linha["type"] == "buy" ? "<span style=\"color:#0a0\">Compra</span>" : "<span style=\"color:#f00\">Venda</span>";
        ?>
</td>
                <td style="text-align:center;"><?php 
        echo $linha["volume"];
        ?>
</td>
                <td style="text-align:center;"><?php 
        echo $linha["price"];
        ?>
    // this can be a new id (!)
    $collection_id = $collection->save($_POST);
} else {
    $collection_id = isset($_REQUEST["collection_id"]) ? intval($_REQUEST["collection_id"]) : 0;
}
$nonce = wp_create_nonce('collection-edit-' . $collection_id);
$block_nonce = wp_create_nonce('mbpro_collection_block-' . $collection_id);
$collection->set($collection_id);
$basic = $collection->getBlock("basic")->get();
$collection_name = $basic["name"];
$tab = isset($_REQUEST["tab"]) ? sanitize_text_field($_REQUEST["tab"]) : '';
$page_title = __("Edit Social Share", "maxbuttons");
$admin = MB()->getClass("admin");
$action = "<a class='page-title-action add-new-h2' href='" . admin_url() . "admin.php?page=maxbuttons-collections&action=edit&collection=social'>" . __('Add New', 'maxbuttons') . "</a>";
$admin->get_header(array("tabs_active" => true, "title" => $page_title, "title_action" => $action));
$button = MB()->getClass("button");
?>
			<?php 
if ($collection_id > 0) {
    ?>
			<div class="mb-message shortcode">
				<?php 
    $button_name = $button->getName();
    ?>
				<?php 
    _e('To use this collection, place the following shortcode anywhere in your site content:', 'maxbuttons');
    ?>
				<strong>[maxcollection id="<?php 
    echo $collection_id;
    ?>
"]</strong> <i><?php 
                        </form>
            
  		                
                <div class="clear"></div>
            </div>
        </div>
          </div>   
      
      <?php 
if (isset($_GET["show_replace"])) {
    ?>
           
      <form method="POST"> 
      <div class="option-container">
      <?php 
    $button = MB()->getClass('button');
    $button->set(0);
    $data = $button->get();
    $allfields = array();
    foreach ($data as $block => $fields) {
        $allfields = array_merge($allfields, array_keys($fields));
    }
    $allfields = array_combine($allfields, $allfields);
    wp_nonce_field('mb_bulk_edit', 'bulk_edit');
    ?>
            
        <input type="hidden" name="replace" value="true" />
      	<div class="title"> <?php 
    _e("Bulk edit", "maxbuttons");
    ?>
</div>
 protected function editor_getSocialButtons($packname, $data = array())
 {
     $buttons = array();
     $packsClass = MB()->getClass("pack");
     $packs = $this->editor_getPacks();
     $data = $packs[$packname];
     //$packName = isset($data["tab"]) ? $data["tab"] : '';
     $packpath = $data["path"];
     // isset($data["rel"]) ? $data["rel"] : '';
     $plugin_path = MB()->get_plugin_path(true);
     $rel = str_replace($plugin_path, '', $packpath);
     $socialpath = MB()->get_plugin_path(true) . $rel . "/";
     $socialurl = MB()->get_plugin_url(true) . $rel . "/";
     $socialpack = array("file" => $socialpath . "{$packname}.xml", "img" => '', "dir" => $socialurl, "is_local" => true);
     $packsClass->setPackPath($socialurl);
     $packsClass->load_pack($socialpack);
     $xml = $packsClass->getPackXML();
     foreach ($xml->maxbutton as $xmlbutton) {
         $button_array = $packsClass->parse_pack_button($xmlbutton);
         $button = MB()->getClass('button');
         $button->clear();
         // also ensures all fields are loaded
         $meta = array("is_virtual" => true, "created_source" => "collection");
         $button_array["meta"] = json_encode($meta);
         $button->setupData($button_array);
         if (isset($button_array["collection"])) {
             $coldata = $button_array["collection"];
             // overloading the class to retrieve collection data later on social-block at adding time.
             $button->setData("collection", $coldata);
         }
         $buttons[] = $button;
     }
     return $buttons;
 }