本文整理汇总了PHP中View::newInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP View::newInstance方法的具体用法?PHP View::newInstance怎么用?PHP View::newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::newInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processData
private function processData($pages)
{
if (!empty($pages)) {
$prefLocale = osc_current_user_locale();
foreach ($pages as $aRow) {
$row = array();
$content = array();
if (isset($aRow['locale'][$prefLocale]) && !empty($aRow['locale'][$prefLocale]['s_title'])) {
$content = $aRow['locale'][$prefLocale];
} else {
$content = current($aRow['locale']);
}
// -- options --
$options = array();
View::newInstance()->_exportVariableToView('page', $aRow);
$options[] = '<a href="' . osc_static_page_url() . '" target="_blank">' . __('View page') . '</a>';
$options[] = '<a href="' . osc_admin_base_url(true) . '?page=pages&action=edit&id=' . $aRow['pk_i_id'] . '">' . __('Edit') . '</a>';
if (!$aRow['b_indelible']) {
$options[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=pages&action=delete&id=' . $aRow['pk_i_id'] . '&' . osc_csrf_token_url() . '">' . __('Delete') . '</a>';
}
$auxOptions = '<ul>' . PHP_EOL;
foreach ($options as $actual) {
$auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
}
$actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
$row['bulkactions'] = '<input type="checkbox" name="id[]"" value="' . $aRow['pk_i_id'] . '"" />';
$row['internal_name'] = $aRow['s_internal_name'] . $actions;
$row['title'] = $content['s_title'];
$row['order'] = '<div class="order-box">' . $aRow['i_order'] . ' <img class="up" onclick="order_up(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_up.png') . '" alt="' . __('Up') . '" title="' . __('Up') . '" /> <img class="down" onclick="order_down(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_down.png') . '" alt="' . __('Down') . '" title="' . __('Down') . '" /></div>';
$row = osc_apply_filter('pages_processing_row', $row, $aRow);
$this->addRow($row);
$this->rawRows[] = $aRow;
}
}
}
示例2: pop_title_404
function pop_title_404($title)
{
$header_text = __("Sorry but I can't find the page you're looking for", 'pop');
if (View::newInstance()->_get('pop_404_header_text') != '') {
$header_text = View::newInstance()->_get('pop_404_header_text');
}
return $header_text;
}
示例3: osc_has_static_pages_seo
function osc_has_static_pages_seo()
{
if (!View::newInstance()->_exists('pages')) {
View::newInstance()->_exportVariableToView('pages', Page::newInstance()->listAll(false, 0));
}
$page = View::newInstance()->_next('pages');
View::newInstance()->_exportVariableToView('page_meta', json_decode($page['s_meta'], true));
return $page;
}
示例4: osc_search_pagination
/**
* Gets the pagination links of search pagination
*
* @return string pagination links
*/
function osc_search_pagination()
{
$params = array();
if (View::newInstance()->_exists('search_uri')) {
$params['url'] = osc_base_url() . View::newInstance()->_get('search_uri') . '/{PAGE}';
}
$pagination = new Pagination($params);
return $pagination->doPagination();
}
示例5: popular_ads
function popular_ads($interval)
{
$num_ads = popular_ads_num_ads();
// SETS HOW MANY POPULAR ADS TO DISPLAY
$conn = getConnection();
$item_array = $conn->osc_dbFetchResults("SELECT i.*, l.*, d.*, SUM(s.i_num_views) AS total_views FROM %st_item_stats s\n\tJOIN %st_item i ON s.fk_i_item_id = i.pk_i_id\n\tJOIN %st_item_location l ON s.fk_i_item_id = l.fk_i_item_id\n\tJOIN %st_item_description d ON s.fk_i_item_id = d.fk_i_item_id\n\tWHERE i.dt_pub_date > CURDATE()-INTERVAL %d DAY\n\tAND i.b_enabled = 1 AND i.b_active = 1 AND i.b_spam = 0 AND (i.b_premium = 1 || i.dt_expiration >= CURDATE())\n\tGROUP BY s.fk_i_item_id\n\tORDER BY total_views DESC\n\tLIMIT 0, %d", DB_TABLE_PREFIX, DB_TABLE_PREFIX, DB_TABLE_PREFIX, DB_TABLE_PREFIX, $interval, $num_ads);
if (count($item_array) > 0) {
View::newInstance()->_exportVariableToView('customItems', $item_array);
} else {
echo __('No listings', 'flatter');
}
}
示例6: init
public function init()
{
$data = array_map(function ($v) {
return array("s_internal_name" => $v["s_internal_name"], "locales" => array_map(function ($k, $v) {
return array("fk_c_locale_code" => $k, "s_title" => $v["s_title"], "s_excerpt" => "", "s_text" => $v["s_text"]);
}, array_keys($v["locale"]), array_values($v["locale"])));
}, $this->model->listAll(true));
View::newInstance()->_exportVariableToView("datas", json_encode(array("emails" => $data, "footer" => array("locales" => array_map(function ($v) {
return array("fk_c_locale_code" => $v["pk_c_code"], "s_text" => "");
}, OSCLocale::newInstance()->listAll()))), JSON_PRETTY_PRINT));
}
示例7: processData
private function processData($comments)
{
if (!empty($comments)) {
$csrf_token_url = osc_csrf_token_url();
foreach ($comments as $aRow) {
$row = array();
$options = array();
$options_more = array();
View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($aRow['fk_i_item_id']));
if ($aRow['b_enabled']) {
$options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '&value=DISABLE">' . __('Block') . '</a>';
} else {
$options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '&value=ENABLE">' . __('Unblock') . '</a>';
}
$options_more[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=comments&action=delete&id=' . $aRow['pk_i_id'] . '" id="dt_link_delete">' . __('Delete') . '</a>';
$options[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=comment_edit&id=' . $aRow['pk_i_id'] . '" id="dt_link_edit">' . __('Edit') . '</a>';
if ($aRow['b_active']) {
$options[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '&value=INACTIVE">' . __('Deactivate') . '</a>';
} else {
$options[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '&value=ACTIVE">' . __('Activate') . '</a>';
}
// more actions
$moreOptions = '<li class="show-more">' . PHP_EOL . '<a href="#" class="show-more-trigger">' . __('Show more') . '...</a>' . PHP_EOL . '<ul>' . PHP_EOL;
foreach ($options_more as $actual) {
$moreOptions .= '<li>' . $actual . "</li>" . PHP_EOL;
}
$moreOptions .= '</ul>' . PHP_EOL . '</li>' . PHP_EOL;
// create list of actions
$auxOptions = '<ul>' . PHP_EOL;
foreach ($options as $actual) {
$auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
}
$auxOptions .= $moreOptions;
$auxOptions .= '</ul>' . PHP_EOL;
$actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
$status = $this->get_row_status($aRow);
$row['status-border'] = '';
$row['status'] = $status['text'];
$row['bulkactions'] = '<input type="checkbox" name="id[]" value="' . $aRow['pk_i_id'] . '" />';
if (empty($aRow['s_author_name'])) {
$user = User::newInstance()->findByPrimaryKey($aRow['fk_i_user_id']);
$aRow['s_author_name'] = $user['s_email'];
}
$row['author'] = $aRow['s_author_name'] . ' (<a target="_blank" href="' . osc_item_url() . '">' . osc_item_title() . '</a>)' . $actions;
$row['comment'] = $aRow['s_body'];
$row['date'] = osc_format_date($aRow['dt_pub_date']);
$row = osc_apply_filter('comments_processing_row', $row, $aRow);
$this->addRow($row);
$this->rawRows[] = $aRow;
}
}
}
示例8: osc_search_pagination
/**
* Gets the pagination links of search pagination
*
* @return string pagination links
*/
function osc_search_pagination()
{
$params = array();
if (View::newInstance()->_exists('search_uri')) {
// CANONICAL URL
$params['url'] = osc_base_url() . View::newInstance()->_get('search_uri') . '/{PAGE}';
$params['first_url'] = osc_base_url() . View::newInstance()->_get('search_uri');
} else {
$params['first_url'] = osc_update_search_url(array('iPage' => null));
}
$pagination = new Pagination($params);
return $pagination->doPagination();
}
示例9: doModel
function doModel()
{
switch ($this->action) {
case 'spamNbots':
// calling the spam and bots view
$akismet_key = osc_akismet_key();
$akismet_status = 3;
if ($akismet_key != '') {
require_once osc_lib_path() . 'Akismet.class.php';
$akismet_obj = new Akismet(osc_base_url(), $akismet_key);
$akismet_status = 2;
if ($akismet_obj->isKeyValid()) {
$akismet_status = 1;
}
}
View::newInstance()->_exportVariableToView('akismet_status', $akismet_status);
$this->doView('settings/spamNbots.php');
break;
case 'akismet_post':
// updating spam and bots option
osc_csrf_check();
$updated = 0;
$akismetKey = Params::getParam('akismetKey');
$akismetKey = trim($akismetKey);
$updated = osc_set_preference('akismetKey', $akismetKey);
if ($akismetKey == '') {
osc_add_flash_info_message(_m('Your Akismet key has been cleared'), 'admin');
} else {
osc_add_flash_ok_message(_m('Your Akismet key has been updated'), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=spamNbots');
break;
case 'recaptcha_post':
// updating spam and bots option
osc_csrf_check();
$iUpdated = 0;
$recaptchaPrivKey = Params::getParam('recaptchaPrivKey');
$recaptchaPrivKey = trim($recaptchaPrivKey);
$recaptchaPubKey = Params::getParam('recaptchaPubKey');
$recaptchaPubKey = trim($recaptchaPubKey);
$iUpdated += osc_set_preference('recaptchaPrivKey', $recaptchaPrivKey);
$iUpdated += osc_set_preference('recaptchaPubKey', $recaptchaPubKey);
if ($recaptchaPubKey == '') {
osc_add_flash_info_message(_m('Your reCAPTCHA key has been cleared'), 'admin');
} else {
osc_add_flash_ok_message(_m('Your reCAPTCHA key has been updated'), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=spamNbots');
break;
}
}
示例10: payment_pro_recurring_buttons
function payment_pro_recurring_buttons($subscription, $extra = null)
{
$services = View::newInstance()->_get('_payment_pro_services');
if (is_array($services)) {
foreach ($services as $service => $file) {
$payment = Payment::newInstance($service);
if ($payment) {
$payment->recurringButton($subscription, $extra);
}
}
} else {
_e('No method of payment is available', 'payment_pro');
}
}
示例11: category_select
public static function category_select($categories = null, $item = null, $default_item = null, $parent_selectable = false)
{
// Did user select a specific category to post in?
$catId = Params::getParam('catId');
if (Session::newInstance()->_getForm('catId') != "") {
$catId = Session::newInstance()->_getForm('catId');
}
if ($categories == null) {
if (View::newInstance()->_exists('categories')) {
$categories = View::newInstance()->_get('categories');
} else {
$categories = osc_get_categories();
}
}
if ($item == null) {
$item = osc_item();
}
echo '<select name="catId" id="catId">';
if (isset($default_item)) {
echo '<option value="">' . $default_item . '</option>';
} else {
echo '<option value="">' . __('Select a category') . '</option>';
}
if (count($categories) == 1) {
$parent_selectable = 1;
}
foreach ($categories as $c) {
if (!osc_selectable_parent_categories() && !$parent_selectable) {
echo '<optgroup label="' . $c['s_name'] . '">';
if (isset($c['categories']) && is_array($c['categories'])) {
ItemForm::subcategory_select($c['categories'], $item, $default_item, 1);
}
} else {
$selected = isset($item["fk_i_category_id"]) && $item["fk_i_category_id"] == $c['pk_i_id'] || isset($catId) && $catId == $c['pk_i_id'];
echo '<option value="' . $c['pk_i_id'] . '"' . ($selected ? 'selected="selected"' : '') . '>' . $c['s_name'] . '</option>';
if (isset($c['categories']) && is_array($c['categories'])) {
ItemForm::subcategory_select($c['categories'], $item, $default_item, 1);
}
}
}
echo '</select>';
return true;
}
示例12: toArrayFormat
private function toArrayFormat()
{
$this->result['iTotalRecords'] = $this->total;
$this->result['iTotalDisplayRecords'] = $this->total_filtered;
$this->result['iDisplayLength'] = $this->_get['iDisplayLength'];
$this->result['aaData'] = array();
if (count($this->pages) == 0) {
return;
}
$prefLocale = osc_current_user_locale();
$count = 0;
foreach ($this->pages as $aRow) {
$row = array();
$content = array();
if (isset($aRow['locale'][$prefLocale]) && !empty($aRow['locale'][$prefLocale]['s_title'])) {
$content = $aRow['locale'][$prefLocale];
} else {
$content = current($aRow['locale']);
}
// -- options --
$options = array();
View::newInstance()->_exportVariableToView('page', $aRow);
$options[] = '<a href="' . osc_static_page_url() . '" target="_blank">' . __('View page') . '</a>';
$options[] = '<a href="' . osc_admin_base_url(true) . '?page=pages&action=edit&id=' . $aRow['pk_i_id'] . '">' . __('Edit') . '</a>';
if (!$aRow['b_indelible']) {
$options[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=pages&action=delete&id=' . $aRow['pk_i_id'] . '">' . __('Delete') . '</a>';
}
$auxOptions = '<ul>' . PHP_EOL;
foreach ($options as $actual) {
$auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
}
$actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
$row[] = '<input type="checkbox" name="id[]"" value="' . $aRow['pk_i_id'] . '"" />';
$row[] = $aRow['s_internal_name'] . $actions;
$row[] = $content['s_title'];
$row[] = '<div class="order-box">' . $aRow['i_order'] . ' <img class="up" onclick="order_up(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_up.png') . '" alt="' . __('Up') . '" title="' . __('Up') . '" /> <img class="down" onclick="order_down(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_down.png') . '" alt="' . __('Down') . '" title="' . __('Down') . '" /></div>';
$this->result['aaData'][] = $row;
}
}
示例13: voting_star
<img title="<?php
echo $tooltip;
?>
" src="<?php
voting_star(4, $avg_vote);
?>
">
<img title="<?php
echo $tooltip;
?>
" src="<?php
voting_star(5, $avg_vote);
?>
">
<span style="position:relative; top:-5px;padding-right: 4px; padding-left: 4px; margin-bottom: 3px;"><?php
echo $total;
?>
<?php
_e('votes', 'voting');
?>
</span>
</p>
</div>
</li>
<?php
$count++;
View::newInstance()->_erase('user');
}
?>
</ul>
</div>
示例14: osc_admin_base_url
<h1>
<a href="<?php
echo View::newInstance()->_get('login_admin_url');
?>
" title="<?php
echo View::newInstance()->_get('login_admin_title');
?>
">
<img src="<?php
echo View::newInstance()->_get('login_admin_image');
?>
" border="0" title="<?php
echo View::newInstance()->_get('login_admin_title');
?>
" alt="<?php
echo View::newInstance()->_get('login_admin_title');
?>
" />
</a>
</h1>
<?php
osc_show_flash_message('admin');
?>
<form name="loginform" id="loginform" action="<?php
echo osc_admin_base_url(true);
?>
" method="post">
<input type="hidden" name="page" value="login" />
<input type="hidden" name="action" value="login_post" />
<p>
<label for="user_login">
示例15: osc_get_current_user_locale
/**
* Gets current locale object
*
* @return array
*/
function osc_get_current_user_locale()
{
$locale = OSCLocale::newInstance()->findByPrimaryKey(osc_current_user_locale());
View::newInstance()->_exportVariableToView('locale', $locale);
return $locale;
}