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


PHP Factory::class方法代码示例

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


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

示例1: do

 public function do(string $old = NULL, string $new = NULL, string $newAgain = NULL, array $data = []) : bool
 {
     if (Factory::class('Login')->is()) {
         $old = Properties::$parameters['oldPassword'] ?? $old;
         $new = Properties::$parameters['newPassword'] ?? $new;
         $newAgain = Properties::$parameters['passwordAgain'] ?? $newAgain;
         $data = Properties::$parameters['column'] ?? $data;
         Properties::$parameters = [];
         if (empty($newAgain)) {
             $newAgain = $new;
         }
         $getColumns = INDIVIDUALSTRUCTURES_USER_CONFIG['matching']['columns'];
         $getJoining = INDIVIDUALSTRUCTURES_USER_CONFIG['joining'];
         $joinTables = $getJoining['tables'];
         $jc = $getJoining['column'];
         $pc = $getColumns['password'];
         $uc = $getColumns['username'];
         $tn = INDIVIDUALSTRUCTURES_USER_CONFIG['matching']['table'];
         $encodeType = INDIVIDUALSTRUCTURES_USER_CONFIG['encode'];
         $oldPassword = !empty($encodeType) ? Encode::type($old, $encodeType) : $old;
         $newPassword = !empty($encodeType) ? Encode::type($new, $encodeType) : $new;
         $newPasswordAgain = !empty($encodeType) ? Encode::type($newAgain, $encodeType) : $newAgain;
         if (!empty($joinTables)) {
             $joinData = $data;
             $data = $data[$tn] ?? [$tn];
         }
         $getUserData = Factory::class('Data')->get($tn);
         $username = $getUserData->{$uc};
         $password = $getUserData->{$pc};
         if ($oldPassword != $password) {
             return !($this->error = lang('IndividualStructures', 'user:oldPasswordError'));
         } elseif ($newPassword != $newPasswordAgain) {
             return !($this->error = lang('IndividualStructures', 'user:passwordNotMatchError'));
         } else {
             $data[$pc] = $newPassword;
             $data[$uc] = $username;
             if (!empty($joinTables)) {
                 $joinCol = DB::where($uc, $username)->get($tn)->row()->{$jc};
                 foreach ($joinTables as $table => $joinColumn) {
                     if (isset($joinData[$table])) {
                         DB::where($joinColumn, $joinCol)->update($table, $joinData[$table]);
                     }
                 }
             } else {
                 if (!DB::where($uc, $username)->update($tn, $data)) {
                     return !($this->error = lang('IndividualStructures', 'user:registerUnknownError'));
                 }
             }
             return $this->success = lang('IndividualStructures', 'user:updateProcessSuccess');
         }
     } else {
         return false;
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:54,代码来源:Update.php

示例2: replace

 public function replace(string $file, $data, $replace) : string
 {
     $file = File::rpath($file);
     if (!is_file($file)) {
         throw new FileNotFoundException($file);
     }
     $fileContentClass = Factory::class('Content');
     $contents = $fileContentClass->read($file);
     $replaceContents = str_ireplace($data, $replace, $contents);
     if ($contents !== $replaceContents) {
         $fileContentClass->write($file, $replaceContents);
     }
     return $replaceContents;
 }
开发者ID:znframework,项目名称:znframework,代码行数:14,代码来源:Forge.php

示例3: do

 public function do(string $redirectUrl = NULL, int $time = 0)
 {
     $getColumns = INDIVIDUALSTRUCTURES_USER_CONFIG['matching']['columns'];
     $tableName = INDIVIDUALSTRUCTURES_USER_CONFIG['matching']['table'];
     $username = $getColumns['username'];
     $password = $getColumns['password'];
     $active = $getColumns['active'];
     $getUserData = Factory::class('Data')->get($tableName)->{$username} ?? NULL;
     if ($getUserData !== NULL) {
         if (!empty($active)) {
             DB::where($username, $getUserData)->update($tableName, [$active => 0]);
         }
         Cookie::delete($username);
         Cookie::delete($password);
         Session::delete($username);
         redirect($redirectUrl, $time);
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:18,代码来源:Logout.php

示例4: fileInfo

 public function fileInfo(string $dir, string $extension = NULL) : array
 {
     $dir = File::rpath($dir);
     if (is_dir($dir)) {
         $files = Factory::class('FileList')->files($dir, $extension);
         $dir = suffix($dir);
         $filesInfo = [];
         foreach ($files as $file) {
             $filesInfo[$file]['basename'] = pathInfos($dir . $file, 'basename');
             $filesInfo[$file]['size'] = filesize($dir . $file);
             $filesInfo[$file]['date'] = filemtime($dir . $file);
             $filesInfo[$file]['readable'] = is_readable($dir . $file);
             $filesInfo[$file]['writable'] = is_writable($dir . $file);
             $filesInfo[$file]['executable'] = is_executable($dir . $file);
             $filesInfo[$file]['permission'] = fileperms($dir . $file);
         }
         return $filesInfo;
     } elseif (is_file($dir)) {
         return (array) File::info($dir);
     } else {
         throw new FolderNotFoundException($dir);
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:23,代码来源:Info.php

示例5: copy

 public function copy(string $source, string $target) : bool
 {
     $source = File::rpath($source);
     $target = File::rpath($target);
     $fileListClass = Factory::class('FileList');
     if (!file_exists($source)) {
         throw new FolderNotFoundException($source);
     }
     if (is_dir($source)) {
         if (!$fileListClass->files($source)) {
             return copy($source, $target);
         } else {
             if (!is_dir($target) && !file_exists($target)) {
                 $this->create($target);
             }
             if (is_array($fileListClass->files($source))) {
                 foreach ($fileListClass->files($source) as $val) {
                     $sourceDir = $source . "/" . $val;
                     $targetDir = $target . "/" . $val;
                     if (is_file($sourceDir)) {
                         copy($sourceDir, $targetDir);
                     }
                     $this->copy($sourceDir, $targetDir);
                 }
             }
             return true;
         }
     } else {
         return copy($source, $target);
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:31,代码来源:Forge.php

示例6: do

 public function do(array $data = NULL, $autoLogin = false, string $activationReturnLink = NULL) : bool
 {
     $data = Properties::$parameters['column'] ?? $data;
     $autoLogin = Properties::$parameters['autoLogin'] ?? $autoLogin;
     $activationReturnLink = Properties::$parameters['returnLink'] ?? $activationReturnLink;
     Properties::$parameters = [];
     // ------------------------------------------------------------------------------
     // Settings
     // ------------------------------------------------------------------------------
     $getColumns = INDIVIDUALSTRUCTURES_USER_CONFIG['matching']['columns'];
     $getJoining = INDIVIDUALSTRUCTURES_USER_CONFIG['joining'];
     $tableName = INDIVIDUALSTRUCTURES_USER_CONFIG['matching']['table'];
     $joinTables = $getJoining['tables'];
     $joinColumn = $getJoining['column'];
     $usernameColumn = $getColumns['username'];
     $passwordColumn = $getColumns['password'];
     $emailColumn = $getColumns['email'];
     $activeColumn = $getColumns['active'];
     $activationColumn = $getColumns['activation'];
     // ------------------------------------------------------------------------------
     if (!empty($joinTables)) {
         $joinData = $data;
         $data = isset($data[$tableName]) ? $data[$tableName] : [$tableName];
     }
     if (!isset($data[$usernameColumn]) || !isset($data[$passwordColumn])) {
         return !($this->error = lang('IndividualStructures', 'user:registerUsernameError'));
     }
     $loginUsername = $data[$usernameColumn];
     $loginPassword = $data[$passwordColumn];
     $encodeType = INDIVIDUALSTRUCTURES_USER_CONFIG['encode'];
     $encodePassword = !empty($encodeType) ? Encode::type($loginPassword, $encodeType) : $loginPassword;
     $usernameControl = DB::where($usernameColumn, $loginUsername)->get($tableName)->totalRows();
     // Daha önce böyle bir kullanıcı
     // yoksa kullanıcı kaydetme işlemini başlat.
     if (empty($usernameControl)) {
         $data[$passwordColumn] = $encodePassword;
         if (!DB::insert($tableName, $data)) {
             return !($this->error = lang('IndividualStructures', 'user:registerUnknownError'));
         }
         if (!empty($joinTables)) {
             $joinCol = DB::where($usernameColumn, $loginUsername)->get($tableName)->row()->{$joinColumn};
             foreach ($joinTables as $table => $joinColumn) {
                 $joinData[$table][$joinTables[$table]] = $joinCol;
                 DB::insert($table, $joinData[$table]);
             }
         }
         $this->success = lang('IndividualStructures', 'user:registerSuccess');
         if (!empty($activationColumn)) {
             if (!isEmail($loginUsername)) {
                 $email = $data[$emailColumn];
             } else {
                 $email = NULL;
             }
             $this->_activation($loginUsername, $encodePassword, $activationReturnLink, $email);
         } else {
             if ($autoLogin === true) {
                 Factory::class('Login')->do($loginUsername, $loginPassword);
             } elseif (is_string($autoLogin)) {
                 redirect($autoLogin);
             }
         }
         return true;
     } else {
         return !($this->error = lang('IndividualStructures', 'user:registerError'));
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:66,代码来源:Register.php

示例7: create

 public function create($app = NULL) : string
 {
     $searchWord = '';
     if (Method::post()) {
         $keyword = Method::post('ML_UPDATE_KEYWORD_HIDDEN');
         $languages = explode(',', Method::post('ML_LANGUAGES'));
         $words = Method::post('ML_UPDATE_WORDS');
         // SEARCH
         if (Method::post('ML_SEARCH_SUBMIT')) {
             $searchWord = Method::post('ML_SEARCH');
         }
         // ADD LANGUAGE
         if (Method::post('ML_ADD_ALL_LANGUAGE_SUBMIT')) {
             Factory::class('Insert')->do(Method::post('ML_ADD_LANGUAGE'), 'example', 'Example');
         }
         // ALL DELETE
         if (Method::post('ML_ALL_DELETE_SUBMIT')) {
             $allDelete = Method::post('ML_ALL_DELETE_HIDDEN');
             Factory::class('Delete')->all($allDelete);
         }
         // ADD
         if (Method::post('ML_ADD_KEYWORD_SUBMIT')) {
             $addWords = Method::post('ML_ADD_WORDS');
             $addKeyword = Method::post('ML_ADD_KEYWORD');
             if (is_numeric($addKeyword)) {
                 $addKeyword = 'Wrong Keyword! Only String.';
             }
             if (!empty($languages)) {
                 foreach ($languages as $key => $lang) {
                     Factory::class('Insert')->do($lang, $addKeyword, $addWords[$key]);
                 }
             }
         }
         // UPDATE
         if (Method::post('ML_UPDATE_KEYWORD_SUBMIT')) {
             if (!empty($languages)) {
                 foreach ($languages as $key => $lang) {
                     Factory::class('Update')->do($lang, $keyword, $words[$key]);
                 }
             }
         }
         // DELETE
         if (Method::post('ML_DELETE_SUBMIT')) {
             if (!empty($languages)) {
                 foreach ($languages as $key => $lang) {
                     Factory::class('Delete')->do($lang, $keyword);
                 }
             }
         }
     }
     $config = ENCODINGSUPPORT_ML_CONFIG['table'];
     $attributes = $config['attributes'];
     $pagcon = $config['pagination'];
     $placeHolders = $config['placeHolders'];
     $buttonNames = $config['buttonNames'];
     $title = $config['labels']['title'];
     $confirmMessage = $config['labels']['confirm'];
     $process = $config['labels']['process'];
     $keywords = $config['labels']['keywords'];
     $confirmBox = ' onsubmit="return confirm(\'' . $confirmMessage . '\');"';
     $data = Factory::class('Select')->all($app);
     $languageCount = count($data);
     $table = $this->_styleElement();
     $table .= '<table id="ML_TABLE"' . Html::attributes($attributes['table']) . '>';
     $table .= '<thead>';
     $table .= '<tr><th colspan="' . ($languageCount + 4) . '">' . $title . '</th></tr>';
     $table .= '<tr><th>S/L</th>';
     $table .= '<td colspan="' . ($languageCount + 3) . '">';
     $table .= '<form name="ML_SEARCH_ADD_LANGUAGE_FORM" method="post">';
     $table .= Form::attr($attributes['textbox'])->placeholder($placeHolders['search'])->text('ML_SEARCH');
     $table .= Form::attr($attributes['add'])->submit('ML_SEARCH_SUBMIT', $buttonNames['search']);
     $table .= Form::attr($attributes['textbox'])->placeholder($placeHolders['addLanguage'])->text('ML_ADD_LANGUAGE');
     $table .= Form::attr($attributes['add'])->submit('ML_ADD_ALL_LANGUAGE_SUBMIT', $buttonNames['add']) . '</td>';
     $table .= '</form>';
     $table .= '</tr>';
     $table .= '<tr><th>#</th><td><strong>' . $keywords . '</strong></td>';
     $words = [];
     $formObjects = '';
     $languages = implode(',', array_keys($data));
     $mlLanguages = Form::hidden('ML_LANGUAGES', $languages);
     foreach ($data as $lang => $values) {
         $upperLang = strtoupper($lang);
         $table .= '<form name="ML_TOP_FORM_' . $upperLang . '" method="post"' . $confirmBox . '>';
         $table .= '<td><strong>' . $upperLang . Form::hidden('ML_ALL_DELETE_HIDDEN', $lang) . Form::attr($attributes['delete'])->submit('ML_ALL_DELETE_SUBMIT', $buttonNames['delete']) . '</strong></td>';
         $table .= '</form>';
         foreach ($values as $key => $val) {
             $words[$key][] = $val;
         }
         $formObjects .= '<td>' . Form::attr($attributes['textbox'])->placeholder($upperLang)->text('ML_ADD_WORDS[]') . '</td>';
     }
     $table .= '<td><strong>' . $process . '</strong></td>';
     $table .= '</tr>';
     $table .= '</thead>';
     $table .= '<tbody>';
     $table .= '<tr>';
     $table .= '<form name="ML_TOP_FORM" method="post">';
     $table .= '<th>N</th>';
     $table .= '<td>' . $mlLanguages . Form::attr($attributes['textbox'])->placeholder($placeHolders['keyword'])->text('ML_ADD_KEYWORD') . '</td>';
     $table .= $formObjects;
     $table .= '<td>' . Form::attr($attributes['add'])->submit('ML_ADD_KEYWORD_SUBMIT', $buttonNames['add']) . ' ' . Form::attr($attributes['clear'])->reset('ML_ADD_KEYWORD_RESET', $buttonNames['clear']) . '</td>';
//.........这里部分代码省略.........
开发者ID:znframework,项目名称:znframework,代码行数:101,代码来源:Grid.php

示例8: do

 public function do(string $app = NULL, $key, string $data = NULL) : bool
 {
     return Factory::class('Insert')->do($app, $key, $data);
 }
开发者ID:znframework,项目名称:znframework,代码行数:4,代码来源:Update.php

示例9: is

 public function is() : bool
 {
     $getColumns = INDIVIDUALSTRUCTURES_USER_CONFIG['matching']['columns'];
     $tableName = INDIVIDUALSTRUCTURES_USER_CONFIG['matching']['table'];
     $username = $getColumns['username'];
     $password = $getColumns['password'];
     $cUsername = Cookie::select($username);
     $cPassword = Cookie::select($password);
     $result = NULL;
     if (!empty($cUsername) && !empty($cPassword)) {
         $result = DB::where($username, $cUsername, 'and')->where($password, $cPassword)->get($tableName)->totalRows();
     }
     if (isset(Factory::class('Data')->get($tableName)->{$username})) {
         $isLogin = true;
     } elseif (!empty($result)) {
         Session::insert($username, $cUsername);
         Session::insert($password, $cPassword);
         $isLogin = true;
     } else {
         $isLogin = false;
     }
     return $isLogin;
 }
开发者ID:znframework,项目名称:znframework,代码行数:23,代码来源:Login.php


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