function getButtons()
 {
     // should maybe but a 'light init' of buttons?
     $selection = $this->data["selection"];
     $buttonsArray = array();
     if (count($selection) == 0) {
         return $buttonsArray;
     }
     $table = maxUtils::get_buttons_table_name();
     $query_selection = $selection;
     $selectstring = implode($query_selection, ",");
     $sql = "SELECT DISTINCT * FROM {$table} WHERE id in (" . $selectstring . ")";
     global $wpdb;
     $results = $wpdb->get_results($sql, ARRAY_A);
     $data_array = array();
     foreach ($results as $result) {
         $data_array[$result['id']] = $result;
     }
     foreach ($selection as $button_id) {
         $button = MB()->getClass("button");
         // performance: bypass the set ( = query ) for every button
         //$button->set($button_id);
         $data = isset($data_array[$button_id]) ? $data_array[$button_id] : array();
         if (count($data) > 0) {
             maxButtons::buttonLoad(array("button_id" => $button_id));
             // central registration - from button
             $button->setupData($data);
         }
         maxButtons::forceNextID();
         $buttonsArray[] = $button;
     }
     return $buttonsArray;
 }
예제 #2
0
 protected function compile($css)
 {
     $scss = new scssc();
     $scss->setImportPaths(maxButtons::get_plugin_path() . "assets/scss");
     //$scss->setFormatter('scss_formatter_compressed');
     $compile = " @import '_mixins.scss';  " . $css;
     maxButtonsUtils::addTime("CSSParser: Compile start ");
     try {
         $css = $scss->compile($compile);
     } catch (Exception $e) {
         $css = $this->output_css;
     }
     maxButtonsUtils::addTime("CSSParser: Compile end ");
     return $css;
 }
    static function logo()
    {
        ?>
 
			<?php 
        _e('Brought to you by', 'maxbuttons');
        ?>
			<a href="http://maxfoundry.com/products/?ref=mbfree" target="_blank"><img src="<?php 
        echo maxButtons::get_plugin_url();
        ?>
/images/max-foundry.png" alt="Max Foundry" /></a>
			<?php 
        printf(__('Upgrade to MaxButtons Pro today! %sClick Here%s', 'maxbuttons'), '<a href="http://www.maxbuttons.com/pricing/?utm_source=wordpress&utm_medium=mbrepo&utm_content=button-list-upgrade&utm_campaign=plugin">', '</a>');
        ?>
	<?php 
    }
예제 #4
0
 private function compile($css)
 {
     $scss = new scssc();
     $scss->setImportPaths(maxButtons::get_plugin_path() . "assets/");
     $compile = " @import 'mixins.scss';  " . $css;
     $css = $scss->compile($compile);
     /*				
     	try {
     
     	}
     	catch (Exception $e) { 
     		//print_R($e);
     		echo "Warning: Parse failed";
     		//throw new compileException("Compile failed");
     	}
     */
     return $css;
 }
예제 #5
0
 static function getDocumentID($args)
 {
     $button_id = $args["button_id"];
     if (!is_null(self::$current_doc_id) && self::$current_button_id == $button_id) {
         return self::$current_doc_id;
     }
     if (self::$doNext == false) {
         foreach (self::$documentArray as $index => $ids) {
             foreach ($ids as $doc_button_id => $doc_vars) {
                 if ($doc_button_id == $button_id) {
                     if (!$doc_vars["done"]) {
                         return $doc_vars["document_id"];
                     }
                 }
             }
         }
     }
     // if not found in documentarray make a new one
     $loaded = self::$loadedButtons;
     end($loaded);
     $i = 0;
     foreach ($loaded as $btn_id) {
         if ($btn_id == $button_id) {
             $i++;
         }
     }
     $i--;
     // minus the current added button..
     //$index = key($loaded); // find last index
     if ($i == 0) {
         $document_id = $button_id;
     } else {
         $document_id = $button_id . "_" . $i;
     }
     self::$doNext = false;
     self::$current_doc_id = $document_id;
     self::$current_button_id = $button_id;
     return $document_id;
 }
예제 #6
0
 function __construct()
 {
     $this->plugin_url = self::get_plugin_url();
     //plugins_url() . '/' . $this->plugin_name;
     $this->plugin_path = self::get_plugin_path();
     //plugin_dir_path($rootfile);
     $this->plugin_name = trim(basename($this->plugin_path), '/');
     $this->installed_version = get_option('MAXBUTTONS_VERSION_KEY');
     maxInstall::check_database();
     // sigh
     add_action('init', array($this, 'load_textdomain'));
     add_action('admin_init', array($this, 'addthick'));
     add_filter('widget_text', 'do_shortcode');
     add_shortcode('maxbutton', array($this, 'shortcode'));
     add_action("mb-footer", array($this, 'do_footer'), 10, 3);
     add_action("wp_footer", array($this, "footer"));
     add_action('media_buttons_context', array($this, 'maxbuttons_media_button'));
     add_filter('plugin_action_links', array($this, "plugin_action_links"), 10, 2);
     add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
     add_filter("admin_footer_text", array($this, "admin_footer_text"));
     if (is_admin()) {
         add_action('admin_enqueue_scripts', array($this, 'add_admin_styles'));
         add_action('admin_enqueue_scripts', array($this, 'add_admin_scripts'));
         add_action('admin_init', array($this, 'register_settings'));
         add_action('admin_menu', array($this, 'admin_menu'));
         add_action('admin_footer', array($this, 'media_button_admin_footer'));
         add_action('admin_footer', array($this, "footer"));
         // errors in user space. No internal error but user output friendly issues
         add_action("mb_display_notices", array($this, "display_notices"));
         add_action("wp_ajax_getAjaxButtons", array('maxButtonsAdmin', 'getAjaxButtons'));
     }
     $this->setMainClasses();
     // struct for override functionality
     // The second the blocks are being loaded, check dbase integrity
     add_action("mb_blockclassesloaded", array($this, "check_database"));
     self::$instance = $this;
 }
예제 #7
0
 function __construct()
 {
     global $wpdb;
     $this->wpdb = $wpdb;
     // the parser
     $this->cssParser = new maxCSSParser();
     // get all files from blocks map
     // get all blocks via apply filters, do init. Init should not load anything big.
     require_once "block.php";
     $block_paths = apply_filters('mb-block-paths', array(maxButtons::get_plugin_path() . "blocks/"));
     global $blockClass;
     // load requires only once
     if ($blockClass == '' || count($blockClass) == 0) {
         $newBlocks = array();
         foreach ($block_paths as $block_path) {
             $dir_iterator = new RecursiveDirectoryIterator($block_path, FilesystemIterator::SKIP_DOTS);
             $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
             foreach ($iterator as $fileinfo) {
                 $block = $fileinfo->getFilename();
                 if (file_exists($block_path . $block)) {
                     require_once $block_path . $block;
                 }
             }
         }
         ksort($blockOrder);
         foreach ($blockOrder as $prio => $blockArray) {
             foreach ($blockArray as $block) {
                 if (isset($blockClass[$block])) {
                     $newBlocks[$block] = $blockClass[$block];
                 }
             }
         }
         $blockClass = $newBlocks;
         $this->loadBlockClasses($blockClass);
     }
     $this->blocks = array_keys($blockClass);
 }
예제 #8
0
					<td align="center"><img src="<?php 
echo maxButtons::get_plugin_url();
?>
images/checkmark-16.png" alt="Checkmark" /></td>
				</tr>
				<tr>
					<td><?php 
_e('Shortcodes to use anywhere in your WordPress site', 'maxbuttons');
?>
</td>
					<td align="center"><img src="<?php 
echo maxButtons::get_plugin_url();
?>
images/checkmark-16.png" alt="Checkmark" /></td>
					<td align="center"><img src="<?php 
echo maxButtons::get_plugin_url();
?>
images/checkmark-16.png" alt="Checkmark" /></td>
				</tr>
			</table>
			
			<h2><?php 
_e('Get Your Copy Today', 'maxbuttons');
?>
</h2>
			<p><?php 
printf(__('So what are you waiting for? %sGrab your copy of MaxButtons Pro today%s!', '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>
		</div>
	</div>
예제 #9
0
 function MB()
 {
     return maxButtons::getInstance();
 }
예제 #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 
    }
예제 #11
0
 public function display($args = array())
 {
     maxUtils::startTime('button-display-' . $this->id);
     $defaults = array("mode" => 'normal', "preview_part" => "full", "echo" => true, "load_css" => "footer", "compile" => false);
     $output = '';
     // init output;
     $args = wp_parse_args($args, $defaults);
     $cssParser = $this->getCSSParser();
     // init parser
     $this->load_css = $args["load_css"];
     if ($this->id == 0) {
         if (!$args["mode"] == 'editor') {
             return;
         }
         $data = apply_filters("mb-save-fields", array(), array());
         // load defaults
         $data["id"] = 0;
         do_action('mb-data-load', $data);
     }
     $mode = isset($args["mode"]) ? $args["mode"] : "normal";
     switch ($mode) {
         case "preview":
             $preview = true;
             $compile = false;
             break;
         case "editor":
             $preview = true;
             $compile = true;
             // editor is both compile and preview.
             break;
             break;
         case "normal":
             $preview = false;
             $compile = false;
             break;
     }
     if ($this->load_css == "element" || $args["preview_part"] != "full" || $args["compile"] == true) {
         // if css output is on element, for to compile - otherwise inline styles will not be loaded.
         $compile = true;
     } else {
         $compile = false;
     }
     // create button
     //maxUtils::startTime('button-parse-button-'. $this->id);
     $domObj = $this->parse_button($mode);
     //maxUtils::endTime('button-parse-button-' . $this->id);
     maxUtils::startTime('button-parse-css-' . $this->id);
     $this->parse_css($mode, $compile);
     maxUtils::endTime('button-parse-css-' . $this->id);
     if (!$preview) {
         // no js on previews
         $this->parse_js($mode);
     }
     if ($preview) {
         $domObj->find('a', 0)->class .= ' maxbutton-preview';
     }
     if ($preview && $args["preview_part"] != 'full') {
         if ($args["preview_part"] != 'normal') {
             $domObj->find('a', 0)->class .= ' hover';
             $domObj = $cssParser->outputInline($domObj, 'hover');
         } else {
             $domObj->find('a', 0)->class .= ' normal';
             $domObj = $cssParser->outputInline($domObj);
         }
     } elseif ($this->load_css == 'footer') {
         $css = $this->display_css(false, false);
         do_action('mb-footer', $this->id, $css);
         if (!$preview) {
             $js = $this->display_js(false, true);
             do_action('mb-footer', $this->document_id, $js, 'js');
         }
     } elseif ($this->load_css == 'inline') {
         if ($args["echo"]) {
             $this->display_css();
         } else {
             $output .= $this->display_css(false);
         }
     } elseif ($this->load_css == 'element') {
         $domObj->find('a', 0)->class .= ' normal';
         $domObj = $this->cssParser->outputInline($domObj);
         //$this->get_element_css($domObj, 'normal');
     }
     $output .= $domObj->save();
     $output = apply_filters('mb-before-button-output', $output);
     maxButtons::buttonDone(array("button_id" => $this->id, "document_id" => $this->document_id));
     maxUtils::endTime('button-display-' . $this->id);
     if ($args["echo"]) {
         echo $output;
     } else {
         return $output;
     }
 }
예제 #12
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;
        }
        ?>
			<div class="option-container">
				<div class="title"><?php 
        _e('Responsive Settings', 'maxbuttons');
        ?>
</div>
				<div class="inside">
				
					<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>
					</div>
 
					
				<div class='option-design media_queries_options'>
					<?php 
        foreach ($media_query as $item => $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="input max"><input type="text" class="tiny" name="mq_custom_maxwidth[]" value="<?php 
            echo $fields["mq_custom_maxwidth"];
            ?>
" />px</div> 
								<div class="label max"> <?php 
            _e("Max width", "maxbuttons");
            ?>
</div>
								
							</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>
								
						</div>
					<div class="clear"></div>
						<?php 
        }
        ?>
					<div class="new_query_space"></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 maxButtons::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="input max"><input type="text" class="tiny" name="mq_custom_maxwidth[]" value="0" />px</div> 
								<div class="label max"> <?php 
        _e("Max width", "maxbuttons");
        ?>
</div>
								
							</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>
				<div class="clear"></div>
			</div>
			<div id="media_desc">
			<?php 
        foreach ($media_desc as $key => $desc) {
            echo "<span id='{$key}'>{$desc}</span>";
        }
        ?>
			</div>
			

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

			
<?php 
    }
예제 #13
0
 public function update($data)
 {
     $return = false;
     $fields = array();
     foreach ($this->blocks as $block) {
         if (isset($data[$block])) {
             $blockData = $data[$block];
             $fields[$block] = serialize($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 = $this->wpdb->update(maxButtonsUtils::get_buttons_table_name(), $fields, $where, null, $where_format);
         $return = true;
     } else {
         $result = $this->wpdb->insert(maxButtonsUtils::get_buttons_table_name(), $fields);
         $id = $this->wpdb->insert_id;
         $this->id = $id;
         $return = $id;
     }
     if ($result === 0) {
         $error = "Database error " . $this->wpdb->last_error;
         maxButtons::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;
 }
예제 #14
0
    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 
    }
예제 #15
0
				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="padding-top: 3px; padding-left: 40px; background: url(<?php 
    echo maxButtons::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