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


PHP Status::create方法代码示例

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


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

示例1: _markov

 function _markov($params)
 {
     $user = $params['user'];
     $channel = $params['channel'];
     $msg = Utils::cmdout($params);
     $data = DB::get()->val("SELECT data FROM presence WHERE data <> '' AND cssclass='' AND data NOT LIKE '%<%' AND user_id = :user_id ORDER BY RAND() LIMIT 1", array('user_id' => $user->id));
     list($word, ) = explode(' ', $data, 2);
     $output = $word . ' ';
     for ($z = 0; $z < 20; $z++) {
         $data = DB::get()->val("SELECT data FROM presence WHERE data LIKE :chain AND cssclass='' AND data NOT LIKE '%<%' AND user_id = :user_id ORDER BY RAND() LIMIT 1", array('user_id' => $user->id, 'chain' => '%' . $word . '%'));
         if ($data) {
             $words = explode(' ', $data);
             $index = array_search($word, $words);
             if ($index !== false) {
                 if ($word = $words[$index + 1]) {
                     $output .= $word . ' ';
                 }
             }
         } else {
             break;
         }
     }
     $msg .= trim($output);
     Status::create()->data($msg)->user_id($user->id)->cssclass('markov')->channel($channel)->insert();
     return true;
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:26,代码来源:markov.php

示例2: _eagles

 function _eagles($params)
 {
     $user = $params['user'];
     $channel = $params['channel'];
     $rmsg = $params['eagles'];
     if (trim($rmsg) == '') {
         $rmsg = '';
     }
     $schedule = array(array("week" => "Playoffs", "date" => "January 9", "team" => "Green Bay", "stadium" => "Lincoln Financial Field", "time" => "4:30 PM", "tv" => "FOX", "score" => "21 - 16", "result" => "loss"), array("week" => "1", "date" => "September 11", "team" => "St. Louis Rams", "stadium" => "Edward Jones Dome", "time" => "1:00 PM", "tv" => "FOX"), array("week" => "2", "date" => "September 18", "team" => "Atlanta Falcons", "stadium" => "Georgia Dome", "time" => "8:20 PM", "tv" => "NBC"), array("week" => "3", "date" => "September 25", "team" => "New York Giants", "stadium" => "Lincoln Financial Field", "time" => "1:00 PM", "tv" => "FOX"), array("week" => "4", "date" => "October 2", "team" => "San Fransisco 49ers", "stadium" => "Lincoln Financial Field", "time" => "1:00 PM", "tv" => "FOX"), array("week" => "5", "date" => "October 9", "team" => "Buffalo Bills", "stadium" => "Ralph Wilson Stadium", "time" => "1:00 PM", "tv" => "FOX"), array("week" => "6", "date" => "October 16", "team" => "Washington Redskins", "stadium" => "FedEx Field", "time" => "1:00 PM", "tv" => "FOX"), array("week" => "7", "date" => "October 23", "team" => "Bye", "stadium" => "", "time" => "", "tv" => ""), array("week" => "8", "date" => "October 30", "team" => "Dallas Cowboys", "stadium" => "Lincoln Financial Field", "time" => "8:20 PM", "tv" => "NBC"), array("week" => "9", "date" => "November 7", "team" => "Chicago Bears", "stadium" => "Lincoln Financial Field", "time" => "8:30 PM", "tv" => "ESPN"), array("week" => "10", "date" => "November 13", "team" => "Arizona Cardinals", "stadium" => "Lincoln Financial Field", "time" => "1:00 PM", "tv" => "FOX"), array("week" => "11", "date" => "November 20", "team" => "New York Giants", "stadium" => "New Meadowlands Stadium", "time" => "8:20 PM", "tv" => "NBC"), array("week" => "12", "date" => "November 27", "team" => "New England Patriots", "stadium" => "Lincoln Financial Field", "time" => "4:15 PM", "tv" => "CBS"), array("week" => "13", "date" => "December 1", "team" => "Seattle Seahawks", "stadium" => "Qwest Field", "time" => "8:20 PM", "tv" => "NFL Network"), array("week" => "14", "date" => "December 11", "team" => "Miami Dolphins", "stadium" => "Sun Life Stadium", "time" => "1:00 PM", "tv" => "FOX"), array("week" => "15", "date" => "December 18", "team" => "New York Jets", "stadium" => "Lincoln Financial Field", "time" => "4:15 PM", "tv" => "CBS"), array("week" => "16", "date" => "December 24", "team" => "Dallas Cowboys", "stadium" => "Cowboys Stadium", "time" => "4:15 PM", "tv" => "FOX"), array("week" => "17", "date" => "January 1", "team" => "Washington Redskins", "stadium" => "Lincoln Financial Field", "time" => "1:00 PM", "tv" => "FOX"));
     $announcement = "";
     foreach ($schedule as $key => $row) {
         if (time() < strtotime($row['date'])) {
             if ($row['team'] == "Bye") {
                 $announcement .= "<div class='next_game'>Week Off</div>";
             } else {
                 $announcement .= "<div class='next_game'><div class='label'>Next Game: </div> <div class='date'>" . $row['date'] . "</div> <div class='time'>" . $row['time'] . "</div> <div class='team'>" . $row['team'] . "</div> <div class='stadium'>" . $row['stadium'] . "</div> <div class='tv'>" . $row['tv'] . "</div></div>";
             }
             break;
         } else {
             if ($row['team'] == "Bye") {
                 $announcement = "<div class='last_game'>Week Off</div>";
             } else {
                 $announcement = "<div class='last_game'><div class='label'>Last Game: </div> <div class='score " . $row['result'] . "'>" . $row['score'] . "</div> <div class='date'>" . $row['date'] . "</div> <div class='time'>" . $row['time'] . "</div> <div class='team'>" . $row['team'] . "</div> <div class='stadium'>" . $row['stadium'] . "</div> <div class='tv'>" . $row['tv'] . "</div></div>";
             }
         }
     }
     $rmsg = $announcement;
     $rmsg .= "<br><br>";
     $rmsg .= '<button onclick="play(\'/plugins/eagles/eagles.mp3\');">Play</button>';
     $js = 'bareffect(function(){play("/plugins/eagles/eagles.mp3");});';
     Status::create()->data($rmsg)->user_id($user->id)->cssclass('eagles')->channel($channel)->js($js)->insert();
     return true;
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:33,代码来源:eagles.php

示例3: run

 public function run()
 {
     Status::create(['title' => 'Open']);
     Status::create(['title' => 'In Progress']);
     Status::create(['title' => 'On Hold']);
     Status::create(['title' => 'Closed']);
 }
开发者ID:terrygl,项目名称:SimpleLance,代码行数:7,代码来源:StatusesTableSeeder.php

示例4: _retreat

 function _retreat($params)
 {
     $user = $params['user'];
     $channel = $params['channel'];
     $inchannels = DB::get()->col('SELECT name FROM channels WHERE user_id = :user_id', array('user_id' => $user->id));
     $join = 'office:' . $user->username;
     $joinalias = $this->_room_alias($join);
     foreach ($inchannels as $partchan) {
         DB::get()->query('DELETE FROM channels WHERE name = :name AND user_id = :user_id;', array('name' => $partchan, 'user_id' => $user->id));
         if (preg_match('%^search:(?P<criteria>.+)$%i', $partchan, $searchmatches)) {
             DB::get()->query("DELETE FROM options WHERE name = :name AND grouping = 'searches' AND user_id = :user_id;", array('name' => $searchmatches['criteria'], 'user_id' => $user->id));
         } else {
             if ($partchan != $join) {
                 Status::create()->data("{$user->username} has retreated to <a href=\"#\" onclick=\"joinRoom('" . addslashes($join) . "');return false;\">{$joinalias}</a> from {$partchan}")->type('part')->channel($partchan)->insert();
             }
         }
     }
     DB::get()->query('INSERT INTO channels (name, user_id, last) VALUES (:name, :user_id, NOW());', array('name' => $join, 'user_id' => $user->id));
     if (!($herald = DB::get()->val("SELECT value FROM options WHERE user_id = :user_id AND name = :name AND grouping = :grouping", array('user_id' => $user->id, 'name' => 'Herald', 'grouping' => 'Identity')))) {
         $herald = '{$nickname} has joined {$room}';
     }
     $js = '';
     $cssclass = '';
     $packed = Plugin::call('herald', array('herald' => $herald, 'js' => $js, 'cssclass' => $cssclass));
     extract($packed);
     $herald = str_replace('{$nickname}', $user->nickname, $herald);
     $herald = str_replace('{$room}', $joinalias, $herald);
     $msg = htmlspecialchars($herald);
     Status::create()->data($msg)->type('join')->cssclass($cssclass)->channel($join)->js($js)->insert();
     Immediate::create()->laststatus()->js('setRoom("' . addslashes($join) . '");');
     return true;
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:32,代码来源:retreat.php

示例5: _retcon

    function _retcon($params)
    {
        include_once "Text/Diff.php";
        include_once "Text/Diff/Renderer.php";
        include_once "Text/Diff/Renderer/inline.php";
        $user = $params['user'];
        $channel = $params['channel'];
        $query = $params['query'];
        $status = $params['status'];
        /*		
        		$output = Utils::cmdout($params);
        		$output .= htmlspecialchars($query);
        		
        		Status::create()
        			->data($output)
        			->user_id($user->id)
        			->channel($channel)
        			->insert();
        		   
        		//*/
        $statusok = DB::get()->assoc("SELECT status, data FROM presence WHERE user_id = :user_id AND type = 'message' AND data <> '' AND status = :status ORDER BY msgtime DESC LIMIT 10", array('user_id' => $user->id, 'status' => $status));
        if ($statusok) {
            $data = reset($statusok);
            $diff =& new Text_Diff(explode("\n", $data), explode("\n", htmlspecialchars_decode($query)));
            $renderer =& new Text_Diff_Renderer_inline();
            $replacement = $renderer->render($diff);
            $replacement = addslashes($replacement);
            $replacement = str_replace("\n", '\\n', $replacement);
            $js = <<<REPLJS
retcon({$status}, '{$replacement}');
REPLJS;
            Status::create()->user_id($user->id)->js($js)->channel($channel)->insert();
        }
        return true;
    }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:35,代码来源:retcon.php

示例6: run

 public function run()
 {
     $faker = Faker::create();
     $userIds = User::lists('id');
     foreach (range(1, 1000) as $index) {
         Status::create(['user_id' => $faker->randomElement($userIds), 'body' => $faker->sentence(), 'created_at' => $faker->dateTimeBetween($startDate = '-9 months', $endDate = 'now')]);
     }
 }
开发者ID:jamalots,项目名称:jamalot.dev,代码行数:8,代码来源:StatusesTableSeeder.php

示例7: run

 public function run()
 {
     DB::table('statuses')->delete();
     $stamp = date('Y-m-d H:i:s');
     $statuses_array = array(array('statuses_name' => 'Open', 'created_at' => $stamp, 'updated_at' => $stamp), array('statuses_name' => 'In Progress', 'created_at' => $stamp, 'updated_at' => $stamp), array('statuses_name' => 'On Hold', 'created_at' => $stamp, 'updated_at' => $stamp), array('statuses_name' => 'Closed', 'created_at' => $stamp, 'updated_at' => $stamp));
     foreach ($statuses_array as $added_row) {
         Status::create($added_row);
     }
 }
开发者ID:noikiy,项目名称:laradesk,代码行数:9,代码来源:DatabaseSeeder.php

示例8: _jar

 function _jar($params)
 {
     $jar = $params['jar'];
     $criteria = $params['criteria'];
     $user = $params['user'];
     $channel = $params['channel'];
     $msg = Utils::cmdout($params);
     $msg .= "send this to the jar : " . $criteria;
     Status::create()->data($msg)->user_id($user->id)->cssclass('brainjar')->channel($channel)->insert();
     return true;
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:11,代码来源:brainjar.php

示例9: _calc

 function _calc($params)
 {
     $user = $params['user'];
     $channel = $params['channel'];
     $query = $params['query'];
     $query = html_entity_decode($query);
     $calc = new Calc($query);
     echo htmlspecialchars($expression) . "\n";
     echo $calc->infix() . " = " . $calc->calc() . "\n";
     $output = Utils::cmdout($params);
     $output .= $calc->infix() . " = " . $calc->calc();
     Status::create()->data($output)->user_id($user->id)->channel($channel)->insert();
     return true;
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:14,代码来源:dicecalc.php

示例10: _lions

 function _lions($params)
 {
     $user = $params['user'];
     $channel = $params['channel'];
     $rmsg = $params['lions'];
     if (trim($rmsg) == '') {
         $rmsg = '';
     }
     $rmsg = htmlspecialchars($rmsg);
     $rmsg = '<button onclick="play(\'/plugins/lions/lions.mp3\');">Play</button>' . $rmsg;
     $js = 'bareffect(function(){play("/plugins/lions/lions.mp3");});';
     Status::create()->data($rmsg)->cssclass('lions')->channel($channel)->js($js)->insert();
     return true;
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:14,代码来源:lions.php

示例11: _sound

 function _sound($params)
 {
     $file = $params['file'];
     $style = $params['style'];
     $channel = $params['channel'];
     $user = Auth::user();
     $cssclass = array('sound');
     if ($style != '') {
         $cssclass[] = $style;
     }
     if ($filerow = DB::get()->row('SELECT * FROM files WHERE filename = :file', array('file' => $file))) {
         Status::create()->data(Utils::cmdout($params))->user_id($user->id)->channel($channel)->cssclass(implode(' ', $cssclass))->js('bareffect(function(){play(' . json_encode($filerow->url) . ');});')->insert();
     } else {
         Status::create()->data('Sorry, that file was not found in the file listing.')->user_id($user->id)->type('system')->cssclass('error')->user_to($user->id)->insert();
     }
     return true;
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:17,代码来源:sound.php

示例12: _svn_create

 function _svn_create($params)
 {
     $reponame = $params['reponame'];
     $channel = $params['channel'];
     $user = Auth::user();
     if (preg_match('%^\\w+$%', $reponame)) {
         $repodir = '/var/svn/repos/' . $reponame;
         $output = '';
         $output .= "\n" . shell_exec('svnadmin create ' . $repodir);
         $output .= "\n" . shell_exec('chmod -R g+w ' . $repodir);
         $output .= "\n" . shell_exec('ln -s /var/svn/repos/barchat/hooks/post-commit ' . $repodir . '/hooks/post-commit');
         $output .= "\n" . shell_exec('svn mkdir --username rrs --password 1dc6e78c12a7ec76a349bc63730b85aa -m "Initial directory creation" https://sol.rockriverstar.com/svn/' . $reponame . '/trunk https://sol.rockriverstar.com/svn/' . $reponame . '/tags https://sol.rockriverstar.com/svn/' . $reponame . '/branches 2>&1');
         Status::create()->data(Utils::cmdout($params) . 'Created repo "' . $reponame . '" at https://sol.rockriverstar.com/svn/' . $reponame . '<br/><pre>' . str_replace("\n", '<br>', trim($output)) . '</pre>')->user_id($user->id)->channel($channel)->cssclass('svn')->insert();
     } else {
         Status::create()->data('Sorry, repo names must not already exist and must not contain spaces.')->user_id($user->id)->type('system')->cssclass('error')->user_to($user->id)->insert();
     }
     return true;
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:18,代码来源:svn.php

示例13: _spell

    function _spell($params)
    {
        $user = $params['user'];
        $channel = $params['channel'];
        $presence = DB::get()->row('SELECT status, data FROM presence WHERE user_id = :user_id AND data <> "" ORDER BY msgtime DESC LIMIT 1', array('user_id' => $user->id));
        $data = $presence->data;
        $words = preg_split('%\\W+%', $data);
        $words = array_unique($words);
        $words = array_combine($words, $words);
        $pspell_link = pspell_new("en");
        foreach ($words as $word) {
            if (!pspell_check($pspell_link, $word)) {
                $suggestions = pspell_suggest($pspell_link, $word);
                if (count($suggestions) > 0) {
                    $presence->data = str_replace($word, reset($suggestions), $presence->data);
                } else {
                    $presence->data = str_replace($word, '<s>' . $word . '</s>', $presence->data);
                }
            }
        }
        if ($presence->data == $data) {
            Immediate::ok('No spelling corrections.', $user);
        } else {
            include_once "Text/Diff.php";
            include_once "Text/Diff/Renderer.php";
            include_once "Text/Diff/Renderer/inline.php";
            $diff =& new Text_Diff(explode("\n", $data), explode("\n", htmlspecialchars_decode($presence->data)));
            $renderer =& new Text_Diff_Renderer_inline();
            $replacement = $renderer->render($diff);
            $replacement = addslashes($replacement);
            $replacement = str_replace("\n", '\\n', $replacement);
            $js = <<<REPLJS
retcon({$presence->status}, '{$replacement}');
REPLJS;
            Status::create()->user_id($user->id)->js($js)->channel($channel)->cssclass('spell')->insert();
        }
        return true;
    }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:38,代码来源:spell.php

示例14: _api

 function _api($params)
 {
     $user = $params['user'];
     $name = $params['name'];
     $channel = $params['channel'];
     $output = Utils::cmdout($params);
     $searchurl = 'http://api.drupal.org/api/search/6/' . urlencode($name);
     $thtml = file_get_contents($searchurl);
     $content = SimpleHTML::str_get_html($thtml);
     $tbody = $content->find('table[class=sticky-enabled]', 0);
     if (!is_object($tbody)) {
         $code = $content->find('.active code', 0);
         $output .= '<code style="font-size: 1.5em;line-height: 2em"><a target="_blank" href="' . $searchurl . '">Reference</a>:' . $code->innertext . '</code>';
     } else {
         $trs = $tbody->find('tr');
         $modules = '';
         $count = 0;
         array_shift($trs);
         foreach ($trs as $tr) {
             $tds = $tr->find('td');
             $a = $tds[0]->find('a', 0);
             $modules .= '<li><a target="_blank" href="http://drupal.org/' . $a->href . '">' . $a->innertext . '</a>';
             //	$modules .= htmlspecialchars($tds[2]->innertext);
             $modules .= '</li>';
             if (++$count > 9) {
                 break;
             }
         }
         if ($modules != '') {
             $output .= '<ul style="margin-left:30px;">' . $modules . '</ul>';
         } else {
             $output .= '<p>No results.</p>';
         }
     }
     Status::create()->data($output)->user_id($user->id)->cssclass('drupal api')->channel($channel)->insert();
     return true;
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:37,代码来源:drupal.php

示例15: _contact

    function _contact($params)
    {
        $criteria = $params['criteria'];
        $user = $params['user'];
        $channel = $params['channel'];
        $api = $this->get_api();
        if (is_numeric($criteria)) {
            $bycriteria = array('id' => $criteria);
        } else {
            $bycriteria = array('display_name' => $criteria);
        }
        $results = $api->requestArray('Contact/Get', $bycriteria);
        if (isset($results['Result'])) {
            $result = $results['Result'];
            if (isset($result['is_error'])) {
                if ($result['is_error']) {
                    // Error message in $result['error_message']
                    $msg = $result['error_message'];
                } else {
                    // No error, just no results.
                    $msg = 'No contacts match that criteria.';
                }
                Status::create()->data($msg)->type('system')->user_to($user->id)->cssclass('error')->channel($channel)->insert();
            } elseif (isset($result['contact_id'])) {
                // Single result was sent back.
                $callnum = $this->get_call_num($result['phone']);
                $msg = Utils::cmdout($params);
                $msg .= '<span class="crm-name">
					<a href="http://crm.rockriverstar.com/civicrm/contact/view?reset=1&cid=' . $result['contact_id'] . '" target="_blank">' . $result['display_name'] . '</a>' . '</span>';
                $msg .= '<table class="crm-data">';
                $msg .= '<tr><td>Primary Phone: ' . $this->get_call_num($result['phone']) . '</td>';
                $msg .= '<td>Primary Email: ' . $result['email'] . '</td></tr>';
                $msg .= '<tr>' . '<td>Title: ' . $result['job_title'] . '</td>' . '<td>Employer: ' . $result['current_employer'] . '</td>' . '</tr>';
                $msg .= '</table>';
                Status::create()->data($msg)->user_id($user->id)->cssclass('crm-contact')->channel($channel)->insert();
            } else {
                // Multiple results.
                $msg = Utils::cmdout($params);
                $msg .= '<table><thead><tr><th>Name</th><th>Phone</th><th>Email</th></tr></thead>';
                foreach ($result as $contact) {
                    if (!$contact['is_deleted']) {
                        $callnum = $this->get_call_num($contact['phone']);
                        $msg .= '<tr>';
                        $msg .= '<td><a href="http://crm.rockriverstar.com/civicrm/contact/view?reset=1&cid=' . $contact['contact_id'] . '" target="_blank">' . $contact['display_name'] . '</a></td>';
                        $msg .= '<td>' . $this->get_call_num($contact['phone']) . '</td>';
                        $msg .= '<td><a href="mailto:' . $contact['email'] . '">' . $contact['email'] . '</a></td>';
                        $msg .= '</tr>';
                    }
                }
                $msg .= '</table>';
                Status::create()->data($msg)->user_id($user->id)->cssclass('crm-contact')->channel($channel)->insert();
            }
        } else {
            // Something has gone horribly wrong.
            Status::create()->data('Something has gone horribly wrong.')->type('system')->user_to($user->id)->cssclass('error')->channel($channel)->insert();
        }
        return true;
    }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:58,代码来源:civicrm.php


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