Example #1
0
 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;
 }
Example #2
0
 public function save_fields($data, $post)
 {
     $data = parent::save_fields($data, $post);
     if (isset($post["name"])) {
         $data["name"] = $post["name"];
     }
     return $data;
 }
Example #3
0
 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;
 }
Example #4
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;
 }