当前位置: 首页>>代码示例>>PHP>>正文


PHP Value::SetAndNotNull方法代码示例

本文整理汇总了PHP中Value::SetAndNotNull方法的典型用法代码示例。如果您正苦于以下问题:PHP Value::SetAndNotNull方法的具体用法?PHP Value::SetAndNotNull怎么用?PHP Value::SetAndNotNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Value的用法示例。


在下文中一共展示了Value::SetAndNotNull方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * A widget containing text (essentially just a div or span with text)
  * @param string $text The text to display
  * @param boolean $inline Determines if the widget should be span(true) or div(false)
  * @param string $id The HTML #id of the element
  * @param string $class The HTML .class of element
  * @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
  **/
 public function __construct($text = EMPTYSTRING, $inline = false, $id = null, $class = null, $args = null)
 {
     HtmlAttributes::Assure($args);
     if (Value::SetAndNotNull($id)) {
         $args->Add('id', $id);
     }
     if (Value::SetAndNotNull($class)) {
         $args->Add('class', $class);
     }
     $tag = $inline ? 'span' : 'div';
     parent::__construct($tag, $args, $text);
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:20,代码来源:Textview.php

示例2: __tostring

 public function __tostring()
 {
     $result = EMPTYSTRING;
     if (Value::SetAndNotNull($this->_list) && is_array($this->_list)) {
         ksort($this->_list);
         foreach ($this->_list as $key => $val) {
             if (strstr(BOOLEANPARAMETERS, '|' . $key . '|') && $val == true) {
                 $result .= RTK_SINGLESPACE . $key;
             } else {
                 $result .= RTK_SINGLESPACE . $key . '="' . $val . '"';
             }
         }
     }
     return $result;
 }
开发者ID:iensenfirippu,项目名称:RTK,代码行数:15,代码来源:htmlattribute.php

示例3: AddTextField

 /**
  * Add a text input field to the form
  * @param string $name The HTML name (and #id) of the input field
  * @param string $title The text written next to the input field
  * @param string $value The predefined value in the input field
  * @param integer $size How many rows the input field should span
  * @param HtmlElement $container (optional) The "container" to add it to
  **/
 public function AddTextField($name, $title, $value = null, $size = null, $container = null)
 {
     $args = new HtmlAttributes();
     $args->Add('name', $name);
     $args->Add('id', $name);
     $line = new HtmlElement('div', array('class' => 'formline'));
     $line->AddChild(new HtmlElement('label', array('for' => $name), $title));
     $group = new HtmlElement('div', array('class' => 'formgroup'));
     if ($size == null || intval($size) <= 0) {
         $args->Add('type', 'text');
         if (Value::SetAndNotNull($value)) {
             $args->Add('value', $value);
         }
         $group->AddChild(new HtmlElement('input', $args));
     } else {
         $args->Add('rows', $size);
         $group->AddChild(new HtmlElement('textarea', $args, $value));
     }
     $line->AddChild($group);
     $this->AddToContainer($line, $container);
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:29,代码来源:Form.php

示例4: Insert

 public static function Insert($message, $recipe, $id = EMPTYSTRING)
 {
     $result = false;
     if (Site::HasHttps() && Login::IsLoggedIn()) {
         if (Value::SetAndNotEmpty($message) && Value::SetAndNotNull($recipe)) {
             $path = 'R=' . $recipe;
             if ($id != EMPTYSTRING) {
                 if ($stmt = Database::GetLink()->prepare('SELECT `comment_path` FROM `Comment` WHERE `comment_path` LIKE ?;')) {
                     $stmt->bindParam(1, $path, PDO::PARAM_STR, 255);
                     $stmt->execute();
                     $stmt->bindColumn(1, $result);
                     $stmt->fetch();
                     $stmt->closeCursor();
                     if ($result != null && _string::StartsWith($result, $path)) {
                         $path = $result . '>' . $id;
                     } else {
                         $path = null;
                     }
                 }
             }
             if ($path != null) {
                 $userid = Login::GetId();
                 $timestamp = time();
                 if ($stmt = Database::GetLink()->prepare('INSERT INTO `Comment` (`user_id`, `comment_path`, `comment_contents`, `sent_at`) VALUES (?, ?, ?, ?);')) {
                     $stmt->bindParam(1, $userid, PDO::PARAM_INT);
                     $stmt->bindParam(2, $path, PDO::PARAM_STR, 255);
                     $stmt->bindParam(3, $message, PDO::PARAM_STR, 255);
                     $stmt->bindParam(4, $timestamp, PDO::PARAM_INT);
                     $stmt->execute();
                     $stmt->closeCursor();
                 }
             }
         }
     }
     return $result;
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:36,代码来源:Comment.php

示例5: rand

<?php

// Page Logic
if (Value::SetAndNotNull($_POST, 'submit2')) {
    $image = Site::GetUploadedImage('pffile');
}
$text1 = "Normally, both your asses would be dead as fucking fried chicken, but you happen to pull this shit while I&apos;m in a transitional period so I don&apos;t wanna kill you, I wanna help you. But I can&apos;t give you this case, it don&apos;t belong to me. Besides, I&apos;ve already been through too much shit this morning over this case to hand it over to your dumb ass.";
$text2 = "Look, just because I don&apos;t be givin&apos; no man a foot massage don&apos;t make it right for Marsellus to throw Antwone into a glass motherfuckin&apos; house, fuckin&apos; up the way the nigger talks. Motherfucker do that shit to me, he better paralyze my ass, &apos;cause I&apos;ll kill the motherfucker, know what I&apos;m sayin&apos;?";
$text3 = "Your bones don&apos;t break, mine do. That&apos;s clear. Your cells react to bacteria and viruses differently than mine. You don&apos;t get sick, I do. That&apos;s also clear. But for some reason, you and I react the exact same way to water. We swallow it too fast, we choke. We get some in our lungs, we drown. However unreal it may seem, we are connected, you and I. We&apos;re on the same curve, just on opposite ends.";
$text4 = "Now that we know who you are, I know who I am. I&apos;m not a mistake! It all makes sense! In a comic, you know how you can tell who the arch-villain&apos;s going to be? He&apos;s the exact opposite of the hero. And most times they&apos;re friends, like you and me! I should&apos;ve known way back when... You know why, David? Because of the kids. They called me Mr Glass";
// Page Output
include_once 'Pages/OnAllPages.php';
$box1 = new RTK_Box(null, 'widgettest');
$box1->AddChild(new RTK_Pagination(Site::GetBaseURL() . 'notreallyalink/', 100, 10, 5));
$box2 = new RTK_Box(null, 'subtest1');
$box2->AddChild(new RTK_Header("Example Recipe #" . rand(100, 1000)));
$box2->AddChild(new RTK_Image('/imgtest.png', 'alttext', array('class' => 'right')));
$box2->AddChild(new RTK_Textview($text1 . $text4, true));
$box2->AddChild(new RTK_Link('woop', 'a link'));
$box2->AddChild(new RTK_Box(null, 'clearfix'));
$box3 = new RTK_Box(null, 'subtest3');
$list = new RTK_ListView(array('woop', 'test', 'wahoo', 'pebkac', 'kesmit'));
$list->AddRow(array('1111', '1111', '1111', '1111', '1111'));
$list->AddRow(array('2222', '2222', '2222', '2222', '2222'));
$list->AddRow(array('3333', '3333', '3333', '3333', '3333'));
$box3->AddChild($list);
$box4 = new RTK_Box(null, 'subtest4');
$form = new RTK_Form('testform');
$form->AddText($text2 . $text3);
$form->AddHiddenField('supersecret', 2);
$form->AddTextField('pfffth', 'Pfft!');
开发者ID:iensenfirippu,项目名称:securipe,代码行数:31,代码来源:Widgets.php

示例6:

// Page Logic
// Make sure that the session variables are set
if (!Value::SetAndNotNull($_SESSION, LOGIN_USERID)) {
    Login::SetId(-1);
}
if (!Value::SetAndNotNull($_SESSION, LOGIN_USERNAME)) {
    Login::SetUsername(EMPTYSTRING);
}
if (!Value::SetAndNotNull($_SESSION, LOGIN_PRIVILEGE)) {
    Login::SetPrivilege(0);
}
if (!Value::SetAndNotNull($_SESSION, LOGIN_ATTEMPTS)) {
    Login::SetAttempts(0);
}
if (!Value::SetAndNotNull($GLOBALS, LOGIN_ERROR)) {
    Login::SetError(EMPTYSTRING);
}
// Handle the login
if (!Login::IsLoggedIn() && Site::CheckSecurityToken()) {
    if (Login::TryToLogin()) {
        Site::BackToHome();
    }
}
// Page Output
include_once 'Pages/OnAllPages.php';
$RTK->AddJavascript('/jquery-2.1.4.min.js');
$RTK->AddJavascript('/login.js');
if (Login::GetError() != EMPTYSTRING) {
    $RTK->AddElement(new RTK_Textview(Login::GetError()));
}
开发者ID:iensenfirippu,项目名称:securipe,代码行数:30,代码来源:Login.php

示例7:

<?php

// Page Logic
$recipe = null;
$id = Site::GetArgumentSafely('id');
if (Value::SetAndNotNull($id)) {
    $recipe = Recipe::Load($id);
    if (Value::SetAndNotNull($recipe)) {
        $recipe->LoadSteps();
        $edit = false;
        //Value::SetAndEqualTo($recipe->GetUsertrue, $GLOBALS, 'EDIT', true);
        if (Value::SetAndNotNull($_POST, 'CommentInput') && Site::CheckSecurityToken()) {
            $message = Site::GetPostValueSafely('CommentInput');
            $commentid = Site::GetPostValueSafely('CommentSelect');
            if (!is_numeric($commentid)) {
                $commentid = EMPTYSTRING;
            }
            Comment::Insert($message, $id, $commentid);
            Site::Redirect(EMPTYSTRING);
        }
    } else {
        Site::BackToHome();
    }
} else {
    Site::BackToHome();
}
// Page Output
include_once 'Pages/OnAllPages.php';
$recipebox = new RTK_Box('recipebox');
$recipedescription = new RTK_Box(null, 'recipedescription');
$recipedescription->AddChild(new RTK_Header($recipe->GetTitle()));
开发者ID:iensenfirippu,项目名称:securipe,代码行数:31,代码来源:ViewRecipe.php

示例8: Sanitize

 /**
  * Sanitizes a string, by encoding potentially malicious characters. 
  * @param string, The string value to sanitize.
  * @param keephtml, Disables the HTML part of the sanitization (not reccomended).
  **/
 public static function Sanitize($string, $flag, $keephtml = false)
 {
     if (Value::SetAndNotNull($flag)) {
         $string = filter_var($string, $flag);
     } else {
         if ($keephtml == false) {
             $string = htmlentities($string);
         }
         _string::EnforceProperLineEndings($string);
     }
     return $string;
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:17,代码来源:Functions.php

示例9: Load

 public function Load($id)
 {
     if (Image::ValidateFile($id)) {
         $image = null;
         $mimetype = Image::GetMimeType($_FILES[$id]['tmp_name']);
         if ($mimetype == 'image/jpeg') {
             $image = imagecreatefromjpeg($_FILES[$id]['tmp_name']);
         } elseif ($mimetype == 'image/png') {
             $image = imagecreatefrompng($_FILES[$id]['tmp_name']);
         } elseif ($mimetype == 'image/gif') {
             $image = imagecreatefromgif($_FILES[$id]['tmp_name']);
         }
         if (Value::SetAndNotNull($image)) {
             $this->_image = $image;
         }
     }
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:17,代码来源:Image.php

示例10: RTK_Textview

$box2->AddChild(new RTK_Textview($text1, true));
$box2->AddChild(new RTK_Box(null, 'clearfix'));
$box3 = new RTK_Box(null, 'subtest3');
$items = array();
$items[] = array('0', 'fisk');
$items[] = array('1', 'ost');
$items[] = array('2', 'ikkefisk');
$box4 = new RTK_Box(null, 'subtest4');
$form = new RTK_Form('testform');
$form->AddTextField('title', 'Recipe title:');
$form->AddTextField('description', 'Description:', null, 5);
$form->AddDropDown('type', 'Type:', $items, $items[2][0]);
$form->AddFileUpload('imagepath', 'Image: ');
$form->AddButton('Submit', 'Submit recipe');
$box4->AddChild($form);
$box4->AddChild(new RTK_Box(null, 'clearfix'));
$box1->AddChild($box2);
$box1->AddChild($box3);
$box1->AddChild($box4);
$RTK->AddElement($box1);
//$recipeId = "1";
if (Value::SetAndNotNull($_POST, 'Submit')) {
    $imagepath = Site::GetPostValueSafely("imagepath");
    $title = Site::GetPostValueSafely("title");
    $type = Site::GetPostValueSafely("type");
    $description = Site::GetPostValueSafely("description");
    //$image = new Image($imagepath);
    //$image->Save();
    $recipe = new Recipe($title, $type, $description, $imagepath);
    //Recipe::createRecipe($imagepath, "1", "1", $title, $description, "9001", "0");
}
开发者ID:iensenfirippu,项目名称:securipe,代码行数:31,代码来源:EditStep.php

示例11: AddToContainer

 /**
  * Adds a child element to a referenced element
  * @param HtmlElement $HtmlElement The element to add
  * @param string $container The name of the reference to insert into
  **/
 protected function AddToContainer($HtmlElement, $container = null)
 {
     if ($container != null && Value::SetAndNotNull($this->_containers[$container])) {
         $this->_containers[$container]->AddChild($HtmlElement);
     } elseif ($this->_pointer != null) {
         $this->_pointer->AddChild($HtmlElement);
     } else {
         $this->AddChild($HtmlElement);
     }
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:15,代码来源:HtmlElement.php

示例12: BanClient

 /**
  * Bans a client (browser), by IP, Proxy IP AND session ID.
  * @param username, the username that the client provided (in hashed form, but will be translated if possible).
  **/
 private static function BanClient()
 {
     $now = time();
     $until = $now + ONEDAY;
     $ip_adr = htmlentities($_SERVER['REMOTE_ADDR']);
     $ip_prx = EMPTYSTRING;
     if (Value::SetAndNotNull($_SERVER, 'HTTP_X_FORWARDED_FOR')) {
         $ip_prx = htmlentities($_SERVER['HTTP_X_FORWARDED_FOR']);
     }
     $session = session_id();
     if (Value::SetAndNotNull($ip_adr) || Value::SetAndNotNull($ip_prx) || Value::SetAndNotNull($session)) {
         if ($stmt = Database::GetLink()->prepare('INSERT INTO Ban (banned_at, banned_until, ip_address, proxy_ip, session_id) VALUES (?, ?, ?, ?, ?);')) {
             $stmt->bindParam(1, $now, PDO::PARAM_INT);
             $stmt->bindParam(2, $until, PDO::PARAM_INT);
             $stmt->bindParam(3, $ip_adr, PDO::PARAM_STR, 45);
             $stmt->bindParam(4, $ip_prx, PDO::PARAM_STR, 255);
             $stmt->bindParam(5, $session, PDO::PARAM_STR, 32);
             $stmt->execute();
             $stmt->closeCursor();
             Login::SetAttempts(0);
         }
     }
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:27,代码来源:Login.php

示例13: array

<?php

// Page Logic
if (!Site::HasHttps() || Login::IsLoggedIn()) {
    Site::BackToHome();
}
$errors = null;
$userName = EMPTYSTRING;
$firstName = EMPTYSTRING;
$lastName = EMPTYSTRING;
$email = EMPTYSTRING;
$telNo = EMPTYSTRING;
if (Value::SetAndNotNull($_POST, 'Submit') && Site::CheckSecurityToken()) {
    $errors = array();
    $userName = Site::GetPostValueSafely("UserName");
    // need to be hashed client-side
    $password = Site::GetPostValueSafely("Password");
    // need to be hashed client-side
    $password2 = Site::GetPostValueSafely("Password2");
    // need to be hashed client-side
    $firstName = Site::GetPostValueSafely("FirstName");
    $lastName = Site::GetPostValueSafely("LastName");
    $email = Site::GetPostValueSafely("email");
    $telNo = Site::GetPostValueSafely("telNo");
    Site::ValidateUserName($userName, $errors);
    Site::ValidatePassword($password, $password2, $errors);
    Site::ValidateEmail($email, $errors);
    Site::ValidatePhoneNo($telNo, $errors);
    if (sizeof($errors) == 0) {
        $user = new User();
        $user->create($userName, $password, $firstName, $lastName, $email, $telNo);
开发者ID:iensenfirippu,项目名称:securipe,代码行数:31,代码来源:CreateUser.php


注:本文中的Value::SetAndNotNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。