本文整理汇总了PHP中Meta::getPages方法的典型用法代码示例。如果您正苦于以下问题:PHP Meta::getPages方法的具体用法?PHP Meta::getPages怎么用?PHP Meta::getPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Meta
的用法示例。
在下文中一共展示了Meta::getPages方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderForm
public function renderForm()
{
$files = Meta::getPages(true, $this->object->page ? $this->object->page : false);
$pages = array('common' => array('name' => $this->l('Default pages'), 'query' => array()), 'module' => array('name' => $this->l('Modules pages'), 'query' => array()));
foreach ($files as $name => $file) {
$k = preg_match('#^module-#', $file) ? 'module' : 'common';
$pages[$k]['query'][] = array('id' => $file, 'page' => $name);
}
$this->fields_form = array('legend' => array('title' => $this->l('Meta tags'), 'image' => '../img/admin/metatags.gif'), 'input' => array(array('type' => 'hidden', 'name' => 'id_meta'), array('type' => 'select', 'label' => $this->l('Page:'), 'name' => 'page', 'options' => array('optiongroup' => array('label' => 'name', 'query' => $pages), 'options' => array('id' => 'id', 'name' => 'page', 'query' => 'query')), 'desc' => $this->l('Name of the related page'), 'required' => true, 'empty_message' => '<p>' . $this->l('There is no page available!') . '</p>'), array('type' => 'text', 'label' => $this->l('Page title:'), 'name' => 'title', 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('Title of this page'), 'size' => 30), array('type' => 'text', 'label' => $this->l('Meta description:'), 'name' => 'description', 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('A short description of your shop'), 'size' => 50), array('type' => 'tags', 'label' => $this->l('Meta keywords:'), 'name' => 'keywords', 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('List of keywords for search engines') . ' ' . $this->l('To add "tags," click in the field, write something, and then press "Enter."'), 'size' => 50), array('type' => 'text', 'label' => $this->l('Rewritten URL:'), 'name' => 'url_rewrite', 'lang' => true, 'required' => true, 'hint' => $this->l('Only letters and hyphens are allowed'), 'desc' => $this->l('e.g. "contacts" for http://mysite.com/shop/contacts to redirect to http://mysite.com/shop/contact-form.php'), 'size' => 50)), 'submit' => array('title' => $this->l(' Save '), 'class' => 'button'));
return parent::renderForm();
}
示例2: displayForm
public function displayForm($isMainTab = true)
{
global $currentIndex;
parent::displayForm();
if (!($meta = $this->loadObject(true))) {
return;
}
$files = Meta::getPages(true, $meta->page ? $meta->page : false);
echo '
<form action="' . $currentIndex . '&token=' . $this->token . '&submitAdd' . $this->table . '=1" method="post">
' . ($meta->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $meta->id . '" />' : '') . '
<fieldset><legend><img src="../img/admin/metatags.gif" />' . $this->l('Meta-Tags') . '</legend>
<label>' . $this->l('Page:') . ' </label>
<div class="margin-form">';
if (!sizeof($files)) {
echo '<p>' . $this->l('There is no page available!') . '</p>';
} else {
echo '
<select name="page">';
foreach ($files as $file) {
echo '<option value="' . $file . '"';
echo $meta->page == $file ? ' selected="selected"' : '';
echo '>' . $file . '.php </option>';
}
echo '
</select><sup> *</sup>
<p class="clear">' . $this->l('Name of the related page') . '</p>';
}
echo '
</div>
<label>' . $this->l('Page\'s title:') . ' </label>
<div class="margin-form">';
foreach ($this->_languages as $language) {
echo '
<div id="title_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input size="33" type="text" name="title_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($meta, 'title', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
<p class="clear">' . $this->l('Title of this page') . '</p>
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'title¤description¤keywords¤url_rewrite', 'title');
echo ' </div>
<div style="clear:both;"> </div>
<label>' . $this->l('Meta description:') . ' </label>
<div class="margin-form">';
foreach ($this->_languages as $language) {
echo '
<div id="description_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input size="50" type="text" name="description_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($meta, 'description', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
<p class="clear">' . $this->l('A short description') . '</p>
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'title¤description¤keywords¤url_rewrite', 'description');
echo ' </div>
<div style="clear:both;"> </div>
<label>' . $this->l('Meta keywords:') . ' </label>
<div class="margin-form">';
foreach ($this->_languages as $language) {
echo '
<div id="keywords_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input size="50" type="text" name="keywords_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($meta, 'keywords', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
<p class="clear">' . $this->l('List of keywords') . '</p>
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'title¤description¤keywords¤url_rewrite', 'keywords');
echo ' </div>
<div style="clear:both;"> </div>
<label>' . $this->l('Rewritten URL:') . ' </label>
<div class="margin-form">';
foreach ($this->_languages as $language) {
echo '
<div id="url_rewrite_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input style="width:300px" type="text" name="url_rewrite_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($meta, 'url_rewrite', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
<p class="clear" style="width:300px">' . $this->l('Example : "contacts" for http://mysite.com/shop/contacts to redirect to http://mysite.com/shop/contact-form.php') . '</p>
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'title¤description¤keywords¤url_rewrite', 'url_rewrite');
echo ' </div>
<div style="clear:both;"> </div>
<div class="margin-form">
<input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" />
</div>
<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
</fieldset>
</form>';
}
示例3: displayForm
public function displayForm()
{
global $currentIndex;
$meta = $this->loadObject(true);
$defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
$languages = Language::getLanguages();
$files = Meta::getPages(true, $meta->page ? $meta->page : false);
echo '
<script type="text/javascript">
id_language = Number(' . $defaultLanguage . ');
</script>
<form action="' . $currentIndex . '&token=' . $this->token . '&submitAdd' . $this->table . '=1" method="post" class="width3" style="width:650px;">
' . ($meta->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $meta->id . '" />' : '') . '
<fieldset><legend><img src="../img/admin/metatags.gif" />' . $this->l('Meta-Tags') . '</legend>
<label>' . $this->l('Page:') . ' </label>
<div class="margin-form">';
if (!sizeof($files)) {
echo '<p>' . $this->l('There is no page available!') . '</p>';
} else {
echo '
<select name="page">';
foreach ($files as $file) {
echo '<option value="' . $file . '"';
echo $meta->page == $file ? ' selected="selected"' : '';
echo '>' . $file . '.php </option>';
}
echo '
</select><sup> *</sup>
<p style="clear: both;">' . $this->l('Name of the related page') . '</p>';
}
echo '
</div>
<label>' . $this->l('Page\'s title:') . ' </label>
<div class="margin-form">';
foreach ($languages as $language) {
echo '
<div id="title_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
<input size="33" type="text" name="title_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($meta, 'title', intval($language['id_lang'])), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
<p style="clear: both;">' . $this->l('Title of this page') . '</p>
</div>';
}
$this->displayFlags($languages, $defaultLanguage, 'title¤description¤keywords', 'title');
echo ' </div>
<div style="clear:both;"> </div>
<label>' . $this->l('Meta description:') . ' </label>
<div class="margin-form">';
foreach ($languages as $language) {
echo '
<div id="description_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
<input size="50" type="text" name="description_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($meta, 'description', intval($language['id_lang'])), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
<p style="clear: both;">' . $this->l('A short description') . '</p>
</div>';
}
$this->displayFlags($languages, $defaultLanguage, 'title¤description¤keywords', 'description');
echo ' </div>
<div style="clear:both;"> </div>
<label>' . $this->l('Meta keywords:') . ' </label>
<div class="margin-form">';
foreach ($languages as $language) {
echo '
<div id="keywords_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
<input size="50" type="text" name="keywords_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($meta, 'keywords', intval($language['id_lang'])), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
<p style="clear: both;">' . $this->l('List of keywords') . '</p>
</div>';
}
$this->displayFlags($languages, $defaultLanguage, 'title¤description¤keywords', 'keywords');
echo ' </div>
<div style="clear:both;"> </div>
<div class="margin-form">
<input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" />
</div>
<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
</fieldset>
</form>';
}
示例4: renderForm
public function renderForm()
{
$files = Meta::getPages(true, $this->object->page ? $this->object->page : false);
$is_index = false;
if (is_object($this->object) && is_array($this->object->url_rewrite) && count($this->object->url_rewrite)) {
foreach ($this->object->url_rewrite as $rewrite) {
if ($is_index != true) {
$is_index = $this->object->page == 'index' && empty($rewrite) ? true : false;
}
}
}
$pages = array('common' => array('name' => $this->l('Default pages'), 'query' => array()), 'module' => array('name' => $this->l('Modules pages'), 'query' => array()));
foreach ($files as $name => $file) {
$k = preg_match('#^module-#', $file) ? 'module' : 'common';
$pages[$k]['query'][] = array('id' => $file, 'page' => $name);
}
$this->fields_form = array('legend' => array('title' => $this->l('Meta tags'), 'icon' => 'icon-tags'), 'input' => array(array('type' => 'hidden', 'name' => 'id_meta'), array('type' => 'select', 'label' => $this->l('Page'), 'name' => 'page', 'options' => array('optiongroup' => array('label' => 'name', 'query' => $pages), 'options' => array('id' => 'id', 'name' => 'page', 'query' => 'query')), 'hint' => $this->l('Name of the related page.'), 'required' => true, 'empty_message' => '<p>' . $this->l('There is no page available!') . '</p>'), array('type' => 'text', 'label' => $this->l('Page title'), 'name' => 'title', 'lang' => true, 'hint' => array($this->l('Title of this page.'), $this->l('Invalid characters:') . ' <>;=#{}')), array('type' => 'text', 'label' => $this->l('Meta description'), 'name' => 'description', 'lang' => true, 'hint' => array($this->l('A short description of your shop.'), $this->l('Invalid characters:') . ' <>;=#{}')), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'keywords', 'lang' => true, 'hint' => array($this->l('List of keywords for search engines.'), $this->l('To add tags, click in the field, write something, and then press the "Enter" key.'), $this->l('Invalid characters:') . ' <>;=#{}')), array('type' => 'text', 'label' => $this->l('Rewritten URL'), 'name' => 'url_rewrite', 'lang' => true, 'required' => true, 'disabled' => (bool) $is_index, 'hint' => array($this->l('For instance, "contacts" for http://example.com/shop/contacts to redirect to http://example.com/shop/contact-form.php'), $this->l('Only letters and hyphens are allowed.')))), 'submit' => array('title' => $this->l('Save')));
return parent::renderForm();
}
示例5: getControllerNameOnLive
private function getControllerNameOnLive($q)
{
$pages = Meta::getPages();
$pages_names = Meta::getMetasByIdLang($this->_cookie->id_lang);
$controllers_list = array();
foreach ($pages_names as $page_name) {
if (isset($page_name['page']) && (isset($pages[$page_name['page']]) || in_array($page_name['page'], $pages) || (isset($pages[str_replace('-', '', $page_name['page'])]) || in_array(str_replace('-', '', $page_name['page']), $pages)))) {
if (stripos($page_name['page'], $q) !== false || stripos($page_name['title'], $q) !== false) {
$controllers_list[] = $page_name;
}
}
}
return $controllers_list;
}