本文整理汇总了PHP中Subject::load_from_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Subject::load_from_name方法的具体用法?PHP Subject::load_from_name怎么用?PHP Subject::load_from_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subject
的用法示例。
在下文中一共展示了Subject::load_from_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
}
if (isset($_GET['term'])) {
$action = 'autocomplete';
$term = $_GET['term'];
}
if (isset($action)) {
switch ($action) {
case "add_new_relationship":
// do something.
$subject_1_name = $_POST['subject_1_name'];
$subject_2_name = $_POST['subject_2_name'];
$description = $_POST['relationship_description'];
$subject_1 = new Subject();
$subject_1->load_from_name($subject_1_name);
$subject_2 = new Subject();
$subject_2->load_from_name($subject_2_name);
$new_rel = new Relationship();
$new_rel->subject_id_1 = $subject_1->id;
$new_rel->subject_id_2 = $subject_2->id;
$new_rel->description = $description;
if ($new_rel->save()) {
return true;
} else {
return false;
}
break;
case "autocomplete":
$a_json = array();
$a_json_row = array();
$db = Database::get_instance();
$query = $db->prepare("SELECT description FROM relationships WHERE description LIKE ? ORDER BY description");
示例2: trim
*/
if (!isset($APP)) {
die;
}
$default_controller = $APP['controller_path'] . '/news_controller.php';
$constraint = NULL;
$id = NULL;
if (isset($_GET['constraint'])) {
$constraint = trim($_GET['constraint']);
}
if (isset($_GET['id'])) {
$id = (int) trim($_GET['id']);
}
$post_data = 'action: "view_subject"';
$news_feeds = new Subject();
$news_feeds->load_from_name('News Feeds');
$feeds_object_array = $news_feeds->to_array();
$feeds_string = '';
foreach ($feeds_object_array['aspects'] as $x) {
$feeds_string .= '"' . $x['aspect_data'] . '",';
}
$feeds_string = rtrim($feeds_string, ",");
?>
<div class="col-xs-12" id="main_view">
<h3>Today's News</h3>
<div id="feed_display" class="feed_stage" style="padding: 0px;"></div>
</div>
<script type="text/javascript">
示例3: trim
* @since File included in initial release
*
*/
// bootstrap the rest of the codebase.
require_once '../config.php';
csfr_protection();
$db = Database::get_instance();
$action = NULL;
if (isset($_POST['action'])) {
$action = trim($_POST['action']);
}
if (isset($action)) {
switch ($action) {
case "view_dash":
break;
case "inspire_me":
$sayings = new Subject();
$sayings->load_from_name('Inspirations');
$sayings_array = $sayings->to_array();
$output = $sayings_array['aspects'][array_rand($sayings_array['aspects'])]['aspect_data'];
// print_r($inspirational_sayings);
echo $output;
break;
default:
new LogEntry(__FILE__ . " was hit with an invalid action, from IP: " . $_SERVER['REMOTE_ADDR']);
echo 'There was an error. It has been logged.';
}
} else {
new LogEntry(__FILE__ . " was hit with no action, from IP: " . $_SERVER['REMOTE_ADDR']);
echo 'There was an error. It has been logged.';
}