本文整理汇总了PHP中Content::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Content::get方法的具体用法?PHP Content::get怎么用?PHP Content::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Content
的用法示例。
在下文中一共展示了Content::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* The {{ all_the_vars }} tag
*
* @return string
*/
public function index()
{
$remove_underscored = $this->fetchParam('remove_underscored', true, null, true);
// Tidy up the context values
$context = $this->context;
foreach ($context as $key => $val) {
// Remove objects. You can't use them in templates.
if (is_object($val)) {
unset($context[$key]);
}
// Remove underscored variables.
if ($remove_underscored && Pattern::startsWith($key, '_')) {
unset($context[$key]);
}
}
// Get extra page data
$this->page_data = Content::get(URL::getCurrent());
// CSS
$output = $this->css->link('all_the_vars');
if (!$this->fetchParam('websafe_font', false, null, true)) {
$output .= '<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Ubuntu+Mono" />';
}
// Create table
$output .= $this->createTable($context, false);
// Display on the screen
die($output);
}
示例2: getParent
/**
* Retrieve the parent page
* @return Array Array containing the content of the parent page
*/
private function getParent()
{
$parent = URL::assemble(URL::popLastSegment(URL::getCurrent()));
if (Taxonomy::isTaxonomyURL($parent)) {
$parent = URL::popLastSegment($parent);
}
return Content::get($parent);
}
示例3: doIt
/**
* @access public
* @param aExtrinsicState
* @ParamType aExtrinsicState
*/
public function doIt($tagRoute, $parameters)
{
$menuEntity = $GLOBALS['sys_menu'];
$menuTemplate = new Content($menuEntity, $menuEntity);
$menuTemplate->setFilter("sys_menu_parent_id", $parameters["parent_id"]);
$menuTemplate->setOrderFields("sys_menu_position", 'sys_menu_parent', "sys_menu0_position");
return $menuTemplate->get();
}
示例4: get_content
function get_content()
{
$param['page'] = 1;
$param['show'] = 20;
// get recent 20 contents
$condition = 'type = ' . BLOGPOST . ' AND author_id = ' . $_SESSION['user']['id'];
$content = Content::get($param, $condition);
return $content;
}
示例5: testContent
public function testContent()
{
$content = new Content(null, TEST_ROOT_ETC . DS . 'content' . DS . 'site.txt');
$this->assertEquals(TEST_ROOT_ETC . DS . 'content' . DS . 'site.txt', $content->root);
$this->assertEquals(TEST_ROOT_ETC . DS . 'content' . DS . 'site.txt', $content->root());
$this->assertEquals('site', $content->name());
$this->assertEquals(array_keys($this->dummyData()), $content->fields());
$this->assertEquals($this->dummyData(), $content->toArray());
$this->assertEquals($this->dummyData(), $content->data());
$this->assertTrue($content->exists());
$this->assertEquals(file_get_contents($content->root()), $content->raw());
foreach ($this->dummyData() as $field => $value) {
$this->assertEquals($value, $content->{$field}());
$this->assertEquals($value, $content->get($field));
$this->assertInstanceOf('Field', $content->{$field}());
$this->assertInstanceOf('Field', $content->get($field));
}
}
示例6: getPath
/**
* Get the path of the current file
*
* @return string Full path
*/
public function getPath()
{
// Get the query string and remove the ordering
$url = Path::pretty(Request::get('path'));
// Remove the 'page' if it's a page.md
$url = Pattern::endsWith($url, 'page') ? URL::popLastSegment($url) : $url;
// Get the content
$content = Content::get($url);
// Path is inside the content
return ltrim($content['_local_path'], '/');
}
示例7: orderHasDownloads
public function orderHasDownloads()
{
$order_details = $this->addon->api('bison')->session->get('order_details');
// Return list of downloads in the order
$download_products = array_filter($order_details['items'], function ($item) {
$entry = Content::get($item['url']);
return isset($entry['download_path']);
});
// Check list for products
return !empty($download_products);
}
示例8: add
public static function add()
{
$visible = 0;
if ($_POST['visible'] == "True") {
$visible = 1;
}
$values = [self::TYPEID => intval($_POST['typeid']), self::TITLE => $_POST['title'], self::CONTENT => $_POST['content'], self::VISIBLE => $visible];
$newId = Database::insert(self::TABLE_NAME, $values);
Content::get($newId);
//TODO detect tags, and add them
//Tag::add($newId, *);
}
示例9: postSavenewhomepagemessage
public function postSavenewhomepagemessage()
{
$validator = Validator::make(Input::all(), array('text' => 'required|min:5'));
if ($validator->fails()) {
$output = array('result' => 0, 'error' => '');
foreach ($validator->messages()->all() as $m) {
$output['error'] .= $m . ' ';
}
return json_encode($output);
}
$message = new Content();
$message->type = 'homepage';
$message->body = Input::get('text');
$message->save();
$output['result'] = 1;
$output['content'] = View::make('snippets.messagebox', array('message' => $message, 'position' => Content::get()->count()))->render();
return Response::json($output);
}
示例10: __construct
function __construct()
{
parent::__construct();
$this->page = Content::get(URL::getCurrent());
// get control and location variables
$this->ignore_seo_image_field = $this->fetchConfig('ignore_seo_image_field');
$this->sharable_image_default = $this->fetchConfig('default_image');
$this->sharable_image_source = $this->fetchConfig('sharable_image_source');
// get the variables that are actually printed in output
$this->site_url = URL::getSiteURL();
$this->page_url = URL::tidy($this->site_url . URL::getCurrent(true));
$this->description = $this->getPageDescription();
$this->twitter = $this->fetchConfig('twitter');
$this->twitter_default_message = $this->fetchConfig('twitter_default_message');
$this->site_name = Config::getSiteName();
$this->image_url = $this->getShareableImage();
$this->page_title = $this->site_name . " | " . $this->getPageTitle();
$this->google_analytics = $this->fetchConfig('google_analytics_key');
}
示例11: Content
function move_down()
{
$cont = new Content();
//$cont->where('parent_section',$this->parent_section );//same section
$cont->where('parent_content', $this->parent_content);
//same parent
$cont->where('cell', $this->cell);
// same cell
$cont->where('sort >', $this->sort);
//greater sort
$cont->get();
//get them to process
// if that content object exists then that place is taken
// so we have to get a place for it
if ($cont->exists()) {
$this->deattach();
$this->sort++;
$this->attach();
return TRUE;
}
return FALSE;
}
示例12: actionDelete
/**
* Deletes a content object
*
* Returns a JSON list of affected wallEntryIds.
*/
public function actionDelete()
{
$this->forcePostRequest();
// Json Array
$json = array();
$json['success'] = false;
$model = Yii::app()->request->getParam('model', "");
$id = (int) Yii::app()->request->getParam('id', 1);
$content = Content::get($model, $id);
if ($content->content->canDelete()) {
// Save wall entry ids which belongs to this post
$json['wallEntryIds'] = array();
// Wall Entry Ids
foreach ($content->content->getWallEntries() as $entry) {
$json['wallEntryIds'][] = $entry->id;
}
$json['wallEntryIds'][] = 0;
if ($content->delete()) {
$json['success'] = true;
}
}
echo CJSON::encode($json);
Yii::app()->end();
}
示例13: getAllowedIPs
/**
* Gets IPs allowed for a given $url
*
* @param string $url URL to retrieve IPs for
* @return array
*/
public function getAllowedIPs($url)
{
// get data
$data = Content::get($url);
// is there data?
if (empty($data['_protect']['ip_address']['allowed'])) {
return array();
}
// grab allowed passwords
return Helper::ensureArray($data['_protect']['ip_address']['allowed']);
}
示例14: form
/**
* Raven form tag pair
*
* {{ raven:form }} {{ /raven:form }}
*
* @return string
*/
public function form()
{
/*
|--------------------------------------------------------------------------
| Formset
|--------------------------------------------------------------------------
|
| Raven really needs a formset to make it useful and secure. We may even
| write a form decorator in the future to generate forms from formsets.
|
*/
$formset = $this->fetchParam('formset', false);
$return = $this->fetchParam('return', URL::getCurrent());
$error_return = $this->fetchParam('error_return', URL::getCurrent());
$multipart = ($this->fetchParam('files', false)) ? "enctype='multipart/form-data'" : '';
$old_values = array();
// Fetch the content if in edit mode
if ($edit = $this->fetchParam('edit')) {
$old_values = Content::get($edit, false, false);
// Throw exception if there's an invalid URL
if (count($old_values) == 0) {
throw new FatalException('Invalid URL for editing');
}
$entry_hash = Helper::encrypt($edit);
}
// Merge old values
$old_values = array_merge($this->flash->get('old_values', array()), $old_values);
// Sanitize data before returning it for display
// $old_values = array_map_deep($old_values, 'htmlspecialchars');
// Set old values to re-populate the form
$data = array();
array_set($data, 'value', $old_values);
array_set($data, 'old_values', $old_values);
/*
|--------------------------------------------------------------------------
| Form HTML
|--------------------------------------------------------------------------
|
| Raven writes a few hidden fields to the form to help processing data go
| more smoothly. Form attributes are accepted as colon/piped options:
| Example: attr="class:form|id:contact-form"
|
| Note: The content of the tag pair is inserted back into the template
|
*/
$form_id = $this->fetchParam('id', true);
$attributes_string = '';
if ($attr = $this->fetchParam('attr', false, null, false, false)) {
$attributes_array = Helper::explodeOptions($attr, true);
foreach ($attributes_array as $key => $value) {
$attributes_string .= " {$key}='{$value}'";
}
}
$html = "<form method='post' {$multipart} {$attributes_string}>\n";
$html .= "<input type='hidden' name='hidden[raven]' value='{$form_id}' />\n";
$html .= "<input type='hidden' name='hidden[formset]' value='{$formset}' />\n";
$html .= "<input type='hidden' name='hidden[return]' value='{$return}' />\n";
$html .= "<input type='hidden' name='hidden[error_return]' value='{$error_return}' />\n";
if ($edit) {
$html .= "<input type='hidden' name='hidden[edit]' value='{$entry_hash}' />\n";
}
/*
|--------------------------------------------------------------------------
| Hook: Form Begin
|--------------------------------------------------------------------------
|
| Occurs in the middle the form allowing additional fields to be added.
| Has access to the current fieldset. Must return HTML.
|
*/
$html .= Hook::run('raven', 'inside_form', 'cumulative', '');
/*
|--------------------------------------------------------------------------
| Hook: Content Preparse
|--------------------------------------------------------------------------
//.........这里部分代码省略.........
示例15: content
/**
* Returns the contents of the current page.
*
* @package Theme
* @return string The content.
*/
function content()
{
return Content::get();
}