当前位置: 首页>>代码示例>>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;未经允许,请勿转载。