public function save_fields($data, $post)
 {
     // Possible solution:
     //	$post["url"] = isset($post["url"]) ? urldecode(urldecode($post["url"])) : '';
     $data = parent::save_fields($data, $post);
     // bypassing sanitize text field - causes problems with URLs and spaces
     $url = isset($post["url"]) ? $post["url"] : '';
     $parsed_url = parse_url($url);
     $rawEncode = array("query", "fragment");
     foreach ($rawEncode as $item) {
         if (isset($parsed_url[$item])) {
             $parsed_url[$item] = rawurlencode($parsed_url[$item]);
         }
     }
     $url = $this->unParseURL($parsed_url);
     $url = str_replace(" ", "%20", trim($url));
     $url = esc_url_raw($url, $this->protocols);
     // str replace - known WP issue with spaces
     $data[$this->blockname]["url"] = $url;
     if (isset($post["name"])) {
         $data["name"] = sanitize_text_field($post["name"]);
     }
     if (isset($post["status"])) {
         $data["status"] = sanitize_text_field($post["status"]);
     }
     // for conversion old - new.
     return $data;
 }
Exemple #2
0
 public function map_fields($map)
 {
     $map = parent::map_fields($map);
     $map["button_width"]["func"] = "updateDimension";
     $map["button_height"]["func"] = "updateDimension";
     return $map;
 }
 public function map_fields($map)
 {
     $map = parent::map_fields($map);
     $map["box_shadow_offset_left"]["func"] = "updateBoxShadow";
     $map["box_shadow_offset_top"]["func"] = "updateBoxShadow";
     $map["box_shadow_width"]["func"] = "updateBoxShadow";
     return $map;
 }
Exemple #4
0
 public function save_fields($data, $post)
 {
     $data = parent::save_fields($data, $post);
     if (isset($post["name"])) {
         $data["name"] = $post["name"];
     }
     return $data;
 }
Exemple #5
0
 public function parse_css($css, $mode = 'normal')
 {
     $css = parent::parse_css($css);
     $css["mb-text"]["normal"]["line-height"] = "1em";
     $css["mb-text"]["normal"]["box-sizing"] = "border-box";
     // default.
     $css["mb-text"]["normal"]["display"] = "block";
     return $css;
 }
Exemple #6
0
 public function parse_css($css, $mode = 'normal')
 {
     $css = parent::parse_css($css);
     $data = $this->data[$this->blockname];
     if (isset($data["important_css"]) && $data["important_css"] == 1) {
         $css["settings"]["important"] = 1;
     }
     return $css;
 }
 public function parse_css($css, $mode = 'normal')
 {
     $css = parent::parse_css($css);
     // allow for font not to be set, but default to theme
     $font_size = $css["mb-text"]["normal"]["font-size"];
     if ($font_size == 0 || $font_size == '0px') {
         unset($css["mb-text"]["normal"]["font-size"]);
     }
     $css["mb-text"]["normal"]["line-height"] = "1em";
     $css["mb-text"]["normal"]["box-sizing"] = "border-box";
     // default.
     $css["mb-text"]["normal"]["display"] = "block";
     return $css;
 }
 public function save_fields($data, $post)
 {
     $data = parent::save_fields($data, $post);
     $blockdata = $data[$this->blockname];
     $button_id = isset($data["id"]) ? $data["id"] : 0;
     $user = wp_get_current_user();
     if ($button_id == 0) {
         $blockdata["created"] = time();
         $blockdata["user_created"] = $user->user_login;
     }
     $blockdata["modified"] = time();
     $blockdata["user_modified"] = $user->user_login;
     $data[$this->blockname] = $blockdata;
     return $data;
 }
Exemple #9
0
 public function save_fields($data, $post)
 {
     // Possible solution:
     //	$post["url"] = isset($post["url"]) ? urldecode(urldecode($post["url"])) : '';
     $post["url"] = isset($post["url"]) ? urldecode($post["url"]) : '';
     $data = parent::save_fields($data, $post);
     if (isset($post["name"])) {
         $data["name"] = sanitize_text_field($post["name"]);
     }
     if (isset($post["status"])) {
         $data["status"] = sanitize_text_field($post["status"]);
     }
     // for conversion old - new.
     return $data;
 }
Exemple #10
0
 public function parse_css($css, $mode = 'normal')
 {
     $css = parent::parse_css($css);
     $data = $this->data[$this->blockname];
     $csspart = 'mb-container';
     $csspseudo = 'normal';
     $css["mb-container"]["normal"]["display"] = "block";
     $css["mb-center"]["normal"]["display"] = "block";
     $css["mb-center"]["normal"]["text-align"] = "center";
     if (isset($css[$csspart][$csspseudo]["align"])) {
         if ($css[$csspart][$csspseudo]["align"] != '') {
             $stat = explode(":", $css[$csspart][$csspseudo]["align"]);
             $css[$csspart][$csspseudo][$stat[0]] = $stat[1];
         }
         unset($css[$csspart][$csspseudo]["align"]);
     }
     if (isset($css[$csspart][$csspseudo]["width"]) && $data["container_width"] == 0) {
         unset($css[$csspart][$csspseudo]["width"]);
     }
     return $css;
 }
 public function parse_css($css, $mode = 'normal')
 {
     $csspart = 'mb-icon';
     $csspseudo = 'normal';
     $data = isset($this->data[$this->blockname]) ? $this->data[$this->blockname] : array();
     if (count($data) == 0) {
         return $css;
     }
     // no icons present here.
     $css = parent::parse_css($css);
     $css["mb-icon"]["normal"]["line-height"] = "0px";
     // prevent rendering bigger div than icon
     $css["mb-icon"]["normal"]["display"] = "block";
     /*if (isset($css["maxbutton"]["normal"]["background-image"]))
     		{
     			$url = $css["maxbutton"]["normal"]["background-image"]; 
     			$css["maxbutton"]["normal"]["background-image"] = "url($url)"; 
     		
     		}
     			print_R($css["maxbutton"]);	 		
     		*/
     if (isset($css[$csspart][$csspseudo]["text-align"]) && $css[$csspart][$csspseudo]["text-align"] != '') {
         switch ($css[$csspart][$csspseudo]["text-align"]) {
             case "left":
                 $css[$csspart][$csspseudo]["float"] = 'left';
                 unset($css[$csspart][$csspseudo]["text-align"]);
                 break;
             case "right":
                 $css[$csspart][$csspseudo]["float"] = 'right';
                 unset($css[$csspart][$csspseudo]["text-align"]);
                 break;
             case "top":
             case "bottom":
                 $css[$csspart][$csspseudo]["text-align"] = 'center';
                 break;
         }
     }
     return $css;
 }