當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Validation::validate_url方法代碼示例

本文整理匯總了PHP中Validation::validate_url方法的典型用法代碼示例。如果您正苦於以下問題:PHP Validation::validate_url方法的具體用法?PHP Validation::validate_url怎麽用?PHP Validation::validate_url使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Validation的用法示例。


在下文中一共展示了Validation::validate_url方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: catch

        $json_string = '{ "errors" : "' . $msg . '", "updated_category_id" : ' . $_POST['category_id'] . '}';
    } catch (PAException $e) {
        $json_string = '{ "is_error" : true, "errors" : "' . $e->message . '"}';
    }
    print $json_string;
    /**
    * Creating a new link under the list
    */
} else {
    if (!empty($_POST) && $_POST['form_action'] == 'create_link') {
        //TODO: check for empty fields
        $Links = new Links();
        $Links->user_id = $_SESSION['user']['id'];
        $Links->category_id = $_POST['category_id'];
        $Links->title = $_POST['title'];
        $Links->url = Validation::validate_url($_POST['url']);
        try {
            $Links->save_link();
            $json_string = '{ "errors" : "Link has been added successfully", "updated_category_id" : ' . $_POST['category_id'] . '}';
        } catch (PAException $e) {
            $json_string = '{ "is_error" : true, "errors" : "' . $e->message . '"}';
        }
        print $json_string;
    } else {
        if (!empty($_POST) && $_POST['form_action'] == 'remove_list') {
            $Links = new Links();
            $Links->user_id = $_SESSION['user']['id'];
            $Links->category_id = $_POST['category_id'];
            try {
                $Links->delete_category(true);
                $json_string = '{ "errors" : "List has been deleted successfully"}';
開發者ID:Cyberspace-Networks,項目名稱:PeopleAggregator,代碼行數:31,代碼來源:ajax_links.php

示例2: __

     }
 } else {
     if ($section == 'server_announcement') {
         /*
         $networks_data['announcement_image_url'] = @$_POST['video_url'];
         $networks_data['importance'] = $_POST['importance'];
         $networks_data['description1'] = $_POST['description1'];
         $networks_data['description2'] = $_POST['description2'];
         $networks_data['description3'] = $_POST['description3'];
         */
         for ($counter = 0; $counter < $announcements; $counter++) {
             if (empty($_POST['network_url'][$counter])) {
                 $message[] = __('Network URL cannot be left empty for showcased network ') . ($counter + 1);
                 $networks_data[$counter]['network_url'] = null;
             } else {
                 $networks_data[$counter]['network_url'] = Validation::validate_url($_POST['network_url'][$counter]);
             }
             if (!empty($_POST['caption'][$counter])) {
                 $networks_data[$counter]['caption'] = $_POST['caption'][$counter];
             } else {
                 $networks_data[$counter]['caption'] = null;
             }
             $image_file = 'network_image_' . $counter;
             if (!empty($_FILES[$image_file]['name'])) {
                 //validating and then uploading the network image.
                 $uploader = new FileUploader();
                 //creating instance of file.
                 $file = $uploader->upload_file(PA::$upload_path, $image_file, true, true, 'image');
                 if ($file == false) {
                     $message[] = __(' For showcased network ') . ($counter + 1) . ', ' . $uploader->error;
                     $networks_data[$counter]['network_image'] = null;
開發者ID:Cyberspace-Networks,項目名稱:PeopleAggregator,代碼行數:31,代碼來源:configure_splash_page.php

示例3: split_trackbacks

 public static function split_trackbacks($tblist)
 {
     $track = array();
     foreach (explode(" ", $tblist) as $tb) {
         $t = Validation::validate_url(trim($tb));
         if ($t) {
             $track[] = $t;
         }
     }
     return $track;
 }
開發者ID:CivicCommons,項目名稱:oldBellCaPA,代碼行數:11,代碼來源:Content.php

示例4: initializeModule


//.........這裏部分代碼省略.........
                 } catch (CNException $e) {
                     $msg[] = $e->message;
                 }
             }
         } else {
             if (!empty($request_data['action']) && !empty($request_data['ad_id'])) {
                 $update = false;
                 switch ($request_data['action']) {
                     case 'disable':
                         $field_value = DELETED;
                         $msg_id = 19010;
                         $update = true;
                         break;
                     case 'enable':
                         $field_value = ACTIVE;
                         $msg_id = 19011;
                         $update = true;
                         break;
                 }
                 if ($update) {
                     $update_fields = array('is_active' => $field_value);
                     $condition = array('ad_id' => $request_data['ad_id']);
                     try {
                         Advertisement::update($update_fields, $condition);
                         $error_msg = $msg_id;
                     } catch (CNException $e) {
                         $msg[] = $e->message;
                     }
                 }
             }
         }
     }
     $advertisement = new Advertisement();
     if (!$error && $request_method == 'POST' && $request_data['btn_apply_name']) {
         // if page is submitted
         if (!empty($request_data['ad_id'])) {
             $advertisement->ad_id = $request_data['ad_id'];
             $advertisement->created = $request_data['created'];
             $msg_id = 19007;
         } else {
             $msg_id = 19008;
             $advertisement->created = time();
         }
         if (!empty($_FILES['ad_image']['name'])) {
             $filename = $_FILES['ad_image']['name'];
             $uploadfile = PA::$upload_path . basename($filename);
             $myUploadobj = new FileUploader();
             $file = $myUploadobj->upload_file(PA::$upload_path, 'ad_image', TRUE, TRUE, 'image');
             $advertisement->ad_image = $form_data['ad_image'] = $file;
             if ($file == FALSE) {
                 $error = TRUE;
                 $msg[] = $myUploadobj->error;
             }
         } else {
             if (!empty($request_data['ad_id'])) {
                 $advertisement->ad_image = $request_data['edit_image'];
             }
         }
         if (empty($request_data['ad_url']) && empty($request_data['ad_script'])) {
             $error = TRUE;
             $msg[] = MessagesHandler::get_message(19012);
         }
         if (!empty($request_data['ad_url'])) {
             // if url is given then validate
             $request_data['ad_url'] = Validation::validate_url($request_data['ad_url']);
             if (!Validation::isValidURL($request_data['ad_url'])) {
                 $error = TRUE;
                 $msg[] = MessagesHandler::get_message(19009);
             }
         }
         $advertisement->user_id = PA::$login_uid;
         $advertisement->url = $form_data['ad_url'] = $request_data['ad_url'];
         $advertisement->ad_script = $form_data['ad_script'] = $request_data['ad_script'];
         $advertisement->title = $form_data['ad_title'] = $request_data['ad_title'];
         $advertisement->description = $form_data['ad_description'] = $request_data['ad_description'];
         $advertisement->page_id = $form_data['ad_page_id'] = $request_data['ad_page_id'];
         $advertisement->orientation = $form_data['orientation'] = $request_data['x_loc'] . ',' . $request_data['y_loc'];
         $advertisement->changed = time();
         $advertisement->is_active = ACTIVE;
         if (!empty($_REQUEST['gid'])) {
             $advertisement->group_id = (int) $_REQUEST['gid'];
         }
         if (!$error) {
             try {
                 $ad_id = $advertisement->save();
                 if (!empty($file)) {
                     Storage::link($file, array("role" => "ad", "ad" => $ad_id));
                 }
                 $error_msg = $msg_id;
             } catch (CNException $e) {
                 $error_msg = $e->message;
             }
         } else {
             $error_msg = implode("<br/>", $msg);
         }
     }
     $this->form_data = $form_data;
     $this->edit = $edit;
     $this->message = $message;
 }
開發者ID:Cyberspace-Networks,項目名稱:CoreSystem,代碼行數:101,代碼來源:CNManageAdCenterModule.php

示例5: validate_url

function validate_url($url)
{
    return Validation::validate_url($url);
}
開發者ID:CivicCommons,項目名稱:oldBellCaPA,代碼行數:4,代碼來源:validations.php

示例6:

                 $networks_data[$counter]['network_image'] = null;
             }
         }
     }
     //end for
 } else {
     if ($section == 'network_of_moment') {
         if (empty($_POST['network_caption'])) {
             $message[] = 'No caption given to network of moment';
         } else {
             $networks_data['network_caption'] = $_POST['network_caption'];
         }
         if (empty($_POST['network_url'])) {
             $message[] = 'Please provide url for network of moment';
         } else {
             $networks_data['network_url'] = Validation::validate_url($_POST['network_url']);
         }
     } else {
         if ($section == 'video_tours') {
             if (empty($_POST['video_url'])) {
                 $message[] = 'No video url provided for video tours';
             } else {
                 $networks_data['video_url'] = $_POST['video_url'];
             }
         } else {
             if ($section == 'server_announcement') {
                 $networks_data['announcement_image_url'] = @$_POST['video_url'];
             } else {
                 if ($section == 'configure') {
                     if (!empty($_POST['show_splash_page']) && $_POST['show_splash_page'] == ACTIVE) {
                         $networks_data['show_splash_page'] = ACTIVE;
開發者ID:CivicCommons,項目名稱:oldBellCaPA,代碼行數:31,代碼來源:configure_splash_page.php


注:本文中的Validation::validate_url方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。