本文整理汇总了PHP中Style::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Style::create方法的具体用法?PHP Style::create怎么用?PHP Style::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Style
的用法示例。
在下文中一共展示了Style::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created style in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Style::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
Style::create($data);
return Redirect::route('styles.index');
}
示例2: db_connect
$config["mysql"]["user"] = $_POST["mysql_user"];
$config["mysql"]["passwd"] = $_POST["mysql_password"];
$config["mysql"]["prefix"] = $_POST["table_prefix"];
try {
db_connect();
create_mysql_tables();
/* Writing some demo data to database */
require_once dirname(__FILE__) . "/../sys/models.php";
$ratatoeskr_settings["default_language"] = $lang;
$ratatoeskr_settings["comment_visible_defaut"] = True;
$ratatoeskr_settings["allow_comments_default"] = True;
$ratatoeskr_settings["comment_textprocessor"] = "Markdown";
$ratatoeskr_settings["languages"] = $lang == "en" ? array("en") : array($lang, "en");
$ratatoeskr_settings["last_db_cleanup"] = time();
$ratatoeskr_settings["debugmode"] = False;
$style = Style::create("default");
$style->code = <<<STYLE
* {
\tfont-family: sans-serif;
\tfont-size: 10pt;
}
html {
\tmargin: 0px;
\tpadding: 0px;
}
body {
\tmargin: 0px;
\tpadding: 0px;
}
示例3: Style
}
$hdnPublicStyleId = null;
if (array_key_exists('hdnPublicStyleId', $_REQUEST)) {
$hdnPublicStyleId = $_REQUEST['hdnPublicStyleId'];
}
if (!empty($btnSaveStyle) || !empty($btnMakeStyle)) {
$style = new Style($db);
if ($hdnStyleId == -1) {
$UpdateStyleQuery = "INSERT INTO StyleSheet (i_UID, i_StyleSheetTypeId, i_Public, vc_Name)";
$UpdateStyleQuery .= " VALUES ({$hdnUserId}, 1, {$iStylePublic}, \"{$txtStyleName}\")";
$UpdateStyleQueryId = mysql_query($UpdateStyleQuery);
$GetStyleIdQuery = "SELECT MAX(i_StyleSheetId) i_StyleSheetId FROM StyleSheet where i_UID = {$hdnUserId}";
$GetStyleIdQueryId = mysql_query($GetStyleIdQuery);
$GetStyleIdResults = mysql_fetch_object($GetStyleIdQueryId);
$selUserStyle = $GetStyleIdResults->i_StyleSheetId;
$UpdateStyleQueryId = $style->create($selUserStyle, $txtStyleSheet);
} else {
$selUserStyle = $hdnStyleId;
$UpdateStyleQuery = "UPDATE StyleSheet ";
$UpdateStyleQuery .= " set i_UID = {$hdnUserId},";
$UpdateStyleQuery .= " i_StyleSheetTypeId = 1,";
$UpdateStyleQuery .= " i_Public = {$iStylePublic},";
$UpdateStyleQuery .= " vc_Name = \"{$txtStyleName}\"";
$UpdateStyleQuery .= " WHERE i_StyleSheetId = {$hdnStyleId}";
$UpdateStyleQueryId = mysql_query($UpdateStyleQuery);
$UpdateStyleQueryId = $style->update($hdnStyleId, $txtStyleSheet);
if (!empty($btnMakeStyle)) {
$UpdateUserStyleQuery = "DELETE FROM UserStyleSheet WHERE i_UID = {$hdnUserId}";
$UpdateUserStyleQueryId = mysql_query($UpdateUserStyleQuery);
$UpdateUserStyleQuery = "INSERT INTO UserStyleSheet (i_UID, i_StyleSheetId)";
$UpdateUserStyleQuery .= " VALUES ({$hdnUserId}, {$hdnStyleId})";
示例4: build_backend_subactions
//.........这里部分代码省略.........
if ($properties[1]) {
$ste->vars["textprocessors"][] = $txtproc;
}
}
$ste->vars["sections"] = array();
foreach (Section::all() as $section) {
$ste->vars["sections"][] = $section->name;
}
$ste->vars["article_section"] = $default_section->name;
/* Check Form */
$fail_reasons = array();
if (isset($_POST["save_article"])) {
if (!Article::test_urlname($_POST["urlname"])) {
$fail_reasons[] = $translation["invalid_urlname"];
} else {
$inputs["urlname"] = $_POST["urlname"];
}
if (!Article::test_status(@$_POST["article_status"])) {
$fail_reasons[] = $translation["invalid_article_status"];
} else {
$inputs["article_status"] = (int) $_POST["article_status"];
}
if (!isset($textprocessors[@$_POST["content_txtproc"]])) {
$fail_reasons[] = $translation["unknown_txtproc"];
} else {
$inputs["content_txtproc"] = $_POST["content_txtproc"];
}
if (!isset($textprocessors[@$_POST["excerpt_txtproc"]])) {
$fail_reasons[] = $translation["unknown_txtproc"];
} else {
$inputs["excerpt_txtproc"] = $_POST["excerpt_txtproc"];
}
if (!empty($_POST["date"])) {
if (($time_tmp = @DateTime::createFromFormat("Y-m-d H:i:s", @$_POST["date"])) === False) {
$fail_reasons[] = $translation["invalid_date"];
} else {
$inputs["date"] = @$time_tmp->getTimestamp();
}
} else {
$inputs["date"] = time();
}
$inputs["allow_comments"] = !(empty($_POST["allow_comments"]) or $_POST["allow_comments"] != "yes");
try {
$inputs["article_section"] = Section::by_name($_POST["section"]);
} catch (DoesNotExistError $e) {
$fail_reasons[] = $translation["unknown_section"];
}
$inputs["title"] = $_POST["title"];
$inputs["content"] = $_POST["content"];
$inputs["excerpt"] = $_POST["excerpt"];
$inputs["tags"] = array_filter(array_map("trim", explode(",", $_POST["tags"])), function ($t) {
return !empty($t);
});
if (isset($_POST["saveaslang"])) {
$editlang = $_POST["saveaslang"];
}
} else {
/* Call articleeditor plugins */
$article = empty($article) ? NULL : Article::by_urlname($article);
foreach ($articleeditor_plugins as $plugin) {
call_user_func($plugin["fx"], $article, False);
}
}
function fill_article(&$article, $inputs, $editlang)
{
$article->urlname = $inputs["urlname"];
示例5: changeStyle
function changeStyle()
{
$current_user = new User();
$current_user->createFromID($this->getCurrentUserID());
$deckid = $_POST['deck'];
$deck = new Deck();
$deck->id = $deckid;
$deck->title = $deck->getTitle();
$deck->slug_title = $deck->sluggify($deck->title);
$styleid = isset($_POST['id']) ? $_POST['id'] : 1;
if (isset($_POST['submit'])) {
$response = 1;
$s = $_POST['style'];
if (isset($_POST['new'])) {
$s['based_on'] = $s['id'];
unset($s['id']);
$new_style = new Style();
$new_style->name = $s['name'];
if (!$s['name']) {
header('Location: ' . BASE_PATH . 'error/400');
}
$new_style->user_id = $current_user->id;
$new_style->based_on = $s['based_on'];
$new_style->css = $s['css'];
$new_style->scss_varfunc = $s['scss_varfunc'];
$new_style->scss = $s['scss'];
$new_style->comment = $s['comment'];
$new_style->create();
$styleid = $new_style->id;
} else {
$current_style = new Style();
$current_style->createFromID($s['id']);
$current_style->name = $s['name'];
//$current_style->user_id = $current_user->id;
//$current_style->based_on = $s ['based_on'];
$current_style->css = $s['css'];
$current_style->scss_varfunc = $s['scss_varfunc'];
$current_style->scss = $s['scss'];
$current_style->comment = $s['comment'];
$current_style->save();
$styleid = $s['id'];
}
}
header('Location: style/' . $styleid . '/deck/' . $deckid . '_' . $deck->slug_title);
}