本文整理汇总了PHP中Entry::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Entry::get方法的具体用法?PHP Entry::get怎么用?PHP Entry::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildXHTML
/**
* Construct the widget
*
* @access private
*/
function buildXHTML()
{
$colorpicker = PIWI_URL . 'piwidata/js/colorpicker/ColorPicker2.js';
$popup = PIWI_URL . 'piwidata/js/colorpicker/PopupWindow.js';
$anchor = PIWI_URL . 'piwidata/js/colorpicker/AnchorPosition.js';
$this->addFile($colorpicker);
$this->addFile($popup);
$this->addFile($anchor);
$pickerName = $this->_id . '_colorpicker';
$this->_XHTML = "<script type=\"text/javascript\">\n";
$this->_XHTML .= "var " . $pickerName . "_properties = [];\n";
$this->_XHTML .= $pickerName . "_properties['windowname'] = '" . $this->_popupName . "';\n";
$this->_XHTML .= $pickerName . "_properties['fontStyle'] = '" . $this->_colorFontStyle . "';\n";
$this->_XHTML .= $pickerName . "_properties['fieldID'] = '" . $this->_entry->getID() . "';\n";
if (!empty($this->_onSelectEvent)) {
$this->_onSelectEvent = " " . $this->_onSelectEvent . " ";
}
$this->_XHTML .= $pickerName . "_properties['onselect'] = '" . $this->_onSelectEvent . "';\n";
if ($this->_usePopup) {
$this->_XHTML .= "var " . $pickerName . " = new ColorPicker('window'," . $pickerName . "_properties);\n";
} else {
$this->_XHTML .= "var " . $pickerName . " = new ColorPicker(''," . $pickerName . "_properties);\n";
}
$this->_XHTML .= "</script>\n";
$this->_button->addEvent(ON_CLICK, $pickerName . ".select(document.getElementById('" . $this->_entry->getID() . "'), " . "'" . $pickerName . "_ahref'); return false;");
if (!empty($this->_onSelectEvent)) {
$this->_entry->addEvent(ON_CHANGE, $this->_onSelectEvent);
}
if ($this->_hideInput) {
$this->_entry->setType("hidden");
}
$this->_XHTML .= "<table border=\"0\" style=\"border-spacing: 0px; padding: 0px; border: 0px;\">\n";
$this->_XHTML .= " <tr>\n";
$this->_XHTML .= " <td>\n";
$this->_XHTML .= "<script type=\"text/javascript\">\n";
$this->_XHTML .= "function ExecutePingBackOf" . $this->_entry->getID() . "() {\n";
$this->_XHTML .= " " . $this->_onSelectEvent . "\n";
$this->_XHTML .= "}\n";
$this->_XHTML .= "</script>\n";
$this->_XHTML .= $this->_entry->get();
$this->_XHTML .= " </td>\n";
$this->_XHTML .= " <td>\n";
$this->_XHTML .= "<a id=\"" . $pickerName . "_ahref\"></a>\n";
$this->_XHTML .= $this->_button->get();
$this->_XHTML .= "<script type=\"text/javascript\">\n";
$this->_XHTML .= $pickerName . ".writeDiv();\n";
$this->_XHTML .= "</script>\n";
$this->_XHTML .= " </td>\n";
$this->_XHTML .= " </tr>\n";
$this->_XHTML .= "</table>";
}
示例2: getContent
public function getContent()
{
$content = array();
if ($this->h5ai->getHttpCode($this->absHref) !== "h5ai") {
return $content;
}
$files = $this->h5ai->read_dir($this->absPath);
foreach ($files as $file) {
$entry = Entry::get($this->h5ai, $this->absPath . "/" . $file, $this->absHref . rawurlencode($file));
$content[$entry->absPath] = $entry;
}
$this->isContentFetched = true;
return $content;
}
示例3: get_content
public function get_content(&$cache)
{
$content = array();
if ($this->app->get_http_code($this->abs_href) !== App::$MAGIC_SEQUENCE) {
return $content;
}
$files = $this->app->read_dir($this->abs_path);
foreach ($files as $file) {
$entry = Entry::get($this->app, $this->abs_path . "/" . $file, $cache);
$content[$entry->abs_path] = $entry;
}
$this->is_content_fetched = true;
return $content;
}
示例4: doPOST
public function doPOST()
{
require_once DB_PATH . '/core/lib/entry.php';
$id = intval($this->request->entry);
try {
$entry = new Entry($this->db, $id);
if (!($this->auth->authenticated() && $entry->get('user') == $_SESSION['auth_id'])) {
$entry->check_pass($_POST['password']);
}
$entry->update_tags($_POST['tags']);
$entry->update('title', $_POST['title']);
$entry->update('safe', intval($_POST['rating']));
$entry->save();
redirect('view', $id);
} catch (Exception $e) {
die($e->GetMessage());
redirect('edit', $id);
}
}
示例5: getEntryValue
public function getEntryValue(Entry $entry)
{
if (!$this->initialize()) {
return '';
}
$section = $this->getSection($entry->get('section_id'));
$field = @array_shift($section->fetchVisibleColumns());
$span = new XMLElement('span');
if (is_null($field)) {
return '';
}
$data = $entry->getData($field->get('id'));
if (empty($data)) {
return '';
}
$data = $field->prepareTableValue($data, $span);
if ($data instanceof XMLElement) {
$data = $data->generate();
}
return strip_tags($data);
}
示例6: download_entries_all
public function download_entries_all()
{
header('Content-Type: application/excel');
header('Content-Disposition: attachment; filename="xls/all-entries.csv"');
$config = Config::get("config");
$prepareEntries = Entry::get();
if (count($prepareEntries)) {
$tableheaders = '#,Facebook ID,First Name,Last Name,Email,Gender,Tone,Profile,Created At';
$data = array();
array_push($data, $tableheaders);
foreach ($prepareEntries as $row) {
$item = $row['id'] . "," . $row['facebook_id'] . "," . $row['first_name'] . "," . $row['last_name'] . "," . $row['email'] . "," . $row['gender'] . "," . $row['tone'] . "," . $row['profile'] . "," . $row['created_at'];
array_push($data, $item);
}
$fp = fopen('php://output', 'w');
foreach ($data as $line) {
$val = explode(",", $line);
fputcsv($fp, $val);
}
fclose($fp);
} else {
return "No Entries to Download";
}
}
示例7: processSendMailFilter
/**
* This function handles the Send Mail filter which will send an email
* to each specified recipient informing them that an Entry has been
* created.
*
* @param XMLElement $result
* The XMLElement of the XML that is going to be returned as part
* of this event to the page.
* @param array $send_mail
* Associative array of `send-mail` parameters.
* @param array $fields
* Array of post data to extract the values from
* @param Section $section
* This Section for this event
* @param Section $section
* This current Entry that has just been updated or created
* @return XMLElement
* The modified `$result` with the results of the filter.
*/
public function processSendMailFilter(XMLElement $result, array $send_email, array &$fields, Section $section, Entry $entry)
{
$fields['recipient'] = self::replaceFieldToken($send_email['recipient'], $fields);
$fields['recipient'] = preg_split('/\\,/i', $fields['recipient'], -1, PREG_SPLIT_NO_EMPTY);
$fields['recipient'] = array_map('trim', $fields['recipient']);
$fields['subject'] = self::replaceFieldToken($send_email['subject'], $fields, __('[Symphony] A new entry was created on %s', array(Symphony::Configuration()->get('sitename', 'general'))));
$fields['body'] = self::replaceFieldToken($send_email['body'], $fields, null, false, false);
$fields['sender-email'] = self::replaceFieldToken($send_email['sender-email'], $fields);
$fields['sender-name'] = self::replaceFieldToken($send_email['sender-name'], $fields);
$fields['reply-to-name'] = self::replaceFieldToken($send_email['reply-to-name'], $fields);
$fields['reply-to-email'] = self::replaceFieldToken($send_email['reply-to-email'], $fields);
$edit_link = SYMPHONY_URL . '/publish/' . $section->get('handle') . '/edit/' . $entry->get('id') . '/';
$language = Symphony::Configuration()->get('lang', 'symphony');
$template_path = Event::getNotificationTemplate($language);
$body = sprintf(file_get_contents($template_path), $section->get('name'), $edit_link);
if (is_array($fields['body'])) {
foreach ($fields['body'] as $field_handle => $value) {
$body .= "// {$field_handle}" . PHP_EOL . $value . PHP_EOL . PHP_EOL;
}
} else {
$body .= $fields['body'];
}
// Loop over all the recipients and attempt to send them an email
// Errors will be appended to the Event XML
$errors = array();
foreach ($fields['recipient'] as $recipient) {
$author = AuthorManager::fetchByUsername($recipient);
if (empty($author)) {
$errors['recipient'][$recipient] = __('Recipient not found');
continue;
}
$email = Email::create();
// Huib: Exceptions are also thrown in the settings functions, not only in the send function.
// Those Exceptions should be caught too.
try {
$email->recipients = array($author->get('first_name') => $author->get('email'));
if ($fields['sender-name'] != null) {
$email->sender_name = $fields['sender-name'];
}
if ($fields['sender-email'] != null) {
$email->sender_email_address = $fields['sender-email'];
}
if ($fields['reply-to-name'] != null) {
$email->reply_to_name = $fields['reply-to-name'];
}
if ($fields['reply-to-email'] != null) {
$email->reply_to_email_address = $fields['reply-to-email'];
}
$email->text_plain = str_replace('<!-- RECIPIENT NAME -->', $author->get('first_name'), $body);
$email->subject = $fields['subject'];
$email->send();
} catch (EmailValidationException $e) {
$errors['address'][$author->get('email')] = $e->getMessage();
} catch (EmailGatewayException $e) {
$errors['gateway'][$author->get('email')] = $e->getMessage();
} catch (EmailException $e) {
$errors['email'][$author->get('email')] = $e->getMessage();
}
}
// If there were errors, output them to the event
if (!empty($errors)) {
$xml = self::buildFilterElement('send-email', 'failed');
foreach ($errors as $type => $messages) {
$xType = new XMLElement('error');
$xType->setAttribute('error-type', $type);
foreach ($messages as $recipient => $message) {
$xType->appendChild(new XMLElement('message', $message, array('recipient' => $recipient)));
}
$xml->appendChild($xType);
}
$result->appendChild($xml);
} else {
$result->appendChild(self::buildFilterElement('send-email', 'passed'));
}
return $result;
}
示例8: __wrapFieldWithDiv
private function __wrapFieldWithDiv(Field $field, Entry $entry, $prefix = null, $postfix = null, $css = null)
{
$div = new XMLElement('div', NULL, array('class' => 'field field-' . $field->handle() . ($field->get('required') == 'yes' ? ' required' : '')));
if ($css != null) {
$div->setAttribute('style', $css);
}
$field->displayPublishPanel($div, $_POST['fields'][$field->get('element_name')], isset($this->_errors[$field->get('id')]) ? $this->_errors[$field->get('id')] : NULL, $prefix ? '[' . $prefix . ']' : null, null, is_numeric($entry->get('id')) ? $entry->get('id') : NULL);
return $div;
}
示例9: get_no_js_fallback
public function get_no_js_fallback()
{
date_default_timezone_set("UTC");
$cache = array();
$folder = Entry::get($this, $this->abs_path, $cache);
$entries = $folder->get_content($cache);
uasort($entries, array("Entry", "cmp"));
$html = "<table>";
$html .= "<tr><th></th><th><span>Name</span></th><th><span>Last modified</span></th><th><span>Size</span></th></tr>";
if ($folder->get_parent($cache)) {
$html .= "<tr><td><img src=\"" . $this->app_abs_href . "client/icons/16x16/folder-parent.png\"/></td><td><a href=\"..\">Parent Directory</a></td><td></td><td></td></tr>";
}
foreach ($entries as $entry) {
$html .= "<tr>";
$html .= "<td><img src=\"" . $this->app_abs_href . "client/icons/16x16/" . ($entry->is_folder ? "folder" : "default") . ".png\"/></td>";
$html .= "<td><a href=\"" . $entry->abs_href . "\">" . basename($entry->abs_path) . "</a></td>";
$html .= "<td>" . date("Y-m-d H:i", $entry->date) . "</td>";
$html .= "<td>" . ($entry->size !== null ? intval($entry->size / 1000) . " KB" : "") . "</td>";
$html .= "</tr>";
}
$html .= "</table>";
return $html;
}
示例10: prepareAssociationsDrawerXMLElement
public function prepareAssociationsDrawerXMLElement(Entry $e, array $parent_association, $prepolutate = '')
{
$currentSection = SectionManager::fetch($parent_association['child_section_id']);
$visibleCols = $currentSection->fetchVisibleColumns();
$outputFieldId = current(array_keys($visibleCols));
$outputField = FieldManager::fetch($outputFieldId);
$value = $outputField->prepareReadableValue($e->getData($outputFieldId), $e->get('id'), true, __('None'));
$li = new XMLElement('li');
$li->setAttribute('class', 'field-' . $this->get('type'));
$a = new XMLElement('a', strip_tags($value));
$a->setAttribute('href', SYMPHONY_URL . '/publish/' . $parent_association['handle'] . '/edit/' . $e->get('id') . '/');
$li->appendChild($a);
return $li;
}
示例11: prepareAssociationsDrawerXMLElement
/**
* Format this field value for display in the Associations Drawer publish index.
* By default, Symphony will use the return value of the `prepareReadableValue` function.
*
* @since Symphony 2.4
* @since Symphony 2.5.0 The prepopulate parameter was added.
*
* @param Entry $e
* The associated entry
* @param array $parent_association
* An array containing information about the association
* @param string $prepopulate
* A string containing prepopulate parameter to append to the association url
*
* @return XMLElement
* The XMLElement must be a li node, since it will be added an ul node.
*/
public function prepareAssociationsDrawerXMLElement(Entry $e, array $parent_association, $prepopulate = '')
{
$value = $this->prepareReadableValue($e->getData($this->get('id')), $e->get('id'));
// fallback for compatibility since the default
// `preparePlainTextValue` is not compatible with all fields
// this should be removed in Symphony 3.0
if (empty($value)) {
$value = strip_tags($this->prepareTableValue($e->getData($this->get('id')), null, $e->get('id')));
}
// use our factory method to create the html
$li = self::createAssociationsDrawerXMLElement($value, $e, $parent_association, $prepopulate);
$li->setAttribute('class', 'field-' . $this->get('type'));
return $li;
}
示例12: getNoJsFallback
public function getNoJsFallback()
{
date_default_timezone_set("UTC");
function _cmp($entry1, $entry2)
{
if ($entry1->isFolder && !$entry2->isFolder) {
return -1;
}
if (!$entry1->isFolder && $entry2->isFolder) {
return 1;
}
return strcasecmp($entry1->absHref, $entry2->absHref);
}
$folder = Entry::get($this, $this->absPath, $this->absHref);
$entries = $folder->getContent();
uasort($entries, "_cmp");
$html = "<table>";
$html .= "<tr><th></th><th><span>Name</span></th><th><span>Last modified</span></th><th><span>Size</span></th></tr>";
if ($folder->parent) {
$html .= "<tr><td></td><td><a href=\"..\">Parent Directory</a></td><td></td><td></td></tr>";
}
foreach ($entries as $entry) {
$html .= "<tr>";
$html .= "<td></td>";
$html .= "<td><a href=\"" . $entry->absHref . "\">" . basename($entry->absPath) . ($entry->isFolder ? "/" : "") . "</a></td>";
$html .= "<td>" . date("Y-m-d H:i", $entry->date) . "</td>";
$html .= "<td>" . ($entry->size !== null ? intval($entry->size / 1000) . " KB" : "") . "</td>";
$html .= "</tr>";
}
$html .= "</table>";
return $html;
}
示例13: prepareAssociationsDrawerXMLElement
/**
* Format this field value for display in the Associations Drawer publish index.
* By default, Symphony will use the return value of the `prepareTableValue` function.
*
* @param Entry $e
* The associated entry
* @param array $parent_association
* An array containing information about the parent
*
* return XMLElement
* The XMLElement must be a li node, since it will be added an ul node.
*/
public function prepareAssociationsDrawerXMLElement(Entry $e, array $parent_association)
{
$value = $this->prepareTableValue($e->getData($this->get('id')), null, $e->get('id'));
$li = new XMLElement('li');
$li->setAttribute('class', 'field-' . $this->get('type'));
$a = new XMLElement('a', strip_tags($value));
$a->setAttribute('href', SYMPHONY_URL . '/publish/' . $parent_association['handle'] . '/edit/' . $e->get('id') . '/');
$li->appendChild($a);
return $li;
}
示例14: edit
/**
* Update an existing Entry object given an Entry object
*
* @param Entry $entry
* An Entry object
* @return boolean
*/
public function edit(Entry $entry)
{
foreach ($entry->getData() as $field_id => $field) {
if (empty($field_id)) {
continue;
}
try {
Symphony::Database()->delete('tbl_entries_data_' . $field_id, " `entry_id` = '" . $entry->get('id') . "'");
} catch (Exception $e) {
// Discard?
}
if (!is_array($field) || empty($field)) {
continue;
}
$data = array('entry_id' => $entry->get('id'));
$fields = array();
foreach ($field as $key => $value) {
if (is_array($value)) {
foreach ($value as $ii => $v) {
$fields[$ii][$key] = $v;
}
} else {
$fields[max(0, count($fields) - 1)][$key] = $value;
}
}
foreach ($fields as $index => $field_data) {
$fields[$index] = array_merge($data, $field_data);
}
Symphony::Database()->insert($fields, 'tbl_entries_data_' . $field_id);
}
return true;
}
示例15: __wrapFieldWithDiv
/**
* Given a Field and Entry object, this function will wrap
* the Field's displayPublishPanel result with a div that
* contains some contextual information such as the Field ID,
* the Field handle and whether it is required or not.
*
* @param Field $field
* @param Entry $entry
* @return XMLElement
*/
private function __wrapFieldWithDiv(Field $field, Entry $entry)
{
$div = new XMLElement('div', NULL, array('id' => 'field-' . $field->get('id'), 'class' => 'field field-' . $field->handle() . ($field->get('required') == 'yes' ? ' required' : '')));
$field->displayPublishPanel($div, $entry->getData($field->get('id')), isset($this->_errors[$field->get('id')]) ? $this->_errors[$field->get('id')] : NULL, null, null, is_numeric($entry->get('id')) ? $entry->get('id') : NULL);
return $div;
}