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


PHP test::read方法代碼示例

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


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

示例1: validate_config

 /**
  * Validate item config
  *
  * @since 0.3.0
  *
  * @access protected
  *
  * @param array $data Item config
  *
  * @return bool|array Item config array if valid, false if not.
  */
 protected static function validate_config($data)
 {
     if (!isset($data['created'])) {
         $data['created'] = current_time('mysql');
     }
     if (!isset($data['IP'])) {
         $data['IP'] = ingot_get_ip();
     }
     if (!isset($data['uID'])) {
         $data['uID'] = get_current_user_id();
     }
     if (!isset($data['slug'])) {
         $data['slug'] = self::get_slug();
     }
     if (!isset($data['used'])) {
         $data['used'] = 0;
     }
     if (isset($data['click_test_ID'])) {
         $data['click_test_ID'] = absint($data['click_test_ID']);
     } else {
         $data['click_test_ID'] = 0;
     }
     if ($data['click_test_ID']) {
         $test = test::read($data['click_test_ID']);
         if (!is_array($test)) {
             $data['click_test_ID'] = 0;
         }
     }
     if (isset($data['click_url'])) {
         $data['click_url'] = esc_url_raw($data['click_url']);
     } else {
         $data['click_url'] = '';
     }
     if (!isset($data['ingot_ID'])) {
         $data['ingot_ID'] = self::find_ingot_id($data['uID'], $data['IP']);
     }
     $data['used'] = (bool) $data['used'];
     $data['used'] = (int) $data['used'];
     foreach (self::required() as $key) {
         if (!isset($data[$key])) {
             return new \WP_Error('ingot-session-crud-validation-fail', '', array('fail-key' => $key, 'data' => $data));
         }
     }
     $allowed = array_merge(self::required(), self::needed());
     foreach ($data as $key => $datum) {
         if (!in_array($key, $allowed)) {
             unset($data[$key]);
         } elseif (is_numeric($datum)) {
             $data[$key] = (string) $datum;
         }
     }
     return $data;
 }
開發者ID:Ramoonus,項目名稱:ingot,代碼行數:64,代碼來源:session.php


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