本文整理汇总了PHP中Meta类的典型用法代码示例。如果您正苦于以下问题:PHP Meta类的具体用法?PHP Meta怎么用?PHP Meta使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Meta类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_module_1_3_2_11
function upgrade_module_1_3_2_11($object)
{
$themes = Theme::getThemes();
$theme_meta_value = array();
foreach ($object->controllers as $controller) {
$page = 'module-' . $object->name . '-' . $controller;
$result = Db::getInstance()->getValue('SELECT * FROM ' . _DB_PREFIX_ . 'meta WHERE page="' . pSQL($page) . '"');
if ((int) $result > 0) {
continue;
}
$meta = new Meta();
$meta->page = $page;
$meta->configurable = 0;
$meta->save();
if ((int) $meta->id > 0) {
foreach ($themes as $theme) {
$theme_meta_value[] = array('id_theme' => $theme->id, 'id_meta' => $meta->id, 'left_column' => (int) $theme->default_left_column, 'right_column' => (int) $theme->default_right_column);
}
} else {
$object->_errors[] = sprintf(Tools::displayError('Unable to install controller: %s'), $controller);
}
}
if (count($theme_meta_value) > 0) {
return Db::getInstance()->insert('theme_meta', $theme_meta_value);
}
return true;
}
示例2: CatalogPage
public function CatalogPage()
{
$this->APagesCreator();
$this->updateTitleTagChildren(["Каталог - "]);
$this->setPageCode("catalog_page");
$this->setIsTreeVisible(true);
$this->setIsStatusBarVisible(true);
$this->setIsViewModeBlockVisible(true);
$this->setPathLinkForTree(PathLinks::getDOMForTree());
if (array_key_exists(UrlParameters::KEY, $_GET)) {
$this->key = Utils::getFromGET(UrlParameters::KEY);
$this->setTreeKey($this->key);
$this->setPathLinkForMainBlock(PathLinks::getDOMForTreeCatalog($this->key, $this));
} else {
$this->setPathLinkForMainBlock(PathLinks::getDOMForCatalog());
}
$this->setViewModeBlock(PathLinks::getDOMForViewModeSelector());
$metaDesc = new Meta();
$metaDesc->addAttributes(["name" => "description", "content" => "в каталоге augustova.by вы найдете спецодежду для вашей работы"]);
$treeView = new TreeView();
$treeLabels = implode(", ", $treeView->getAllLabels());
$metaKeyWords = new Meta();
$metaKeyWords->addAttributes(["name" => "keywords", "content" => $treeLabels]);
$this->addMetaTags($metaDesc, $metaKeyWords);
$html = $this->getHtml();
echo $html;
}
示例3: handle_request_models_meta
public static function handle_request_models_meta(\WP_REST_Request $request)
{
$controller = new Meta();
$matches = $controller->parse_route($request->get_route(), '~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~', array('version'));
if ($matches instanceof \WP_REST_Response) {
return $matches;
}
$controller->set_requested_version($matches['version']);
return $controller->send_response($controller->_get_models_metadata_entity());
}
示例4: fbapps
/**
* @before _secure, changeLayout, _admin
*/
public function fbapps()
{
$this->seo(array("title" => "FBApps", "view" => $this->getLayoutView()));
$view = $this->getActionView();
if (RequestMethods::post("action") == "fbapps") {
$fbapp = new Meta(array("user_id" => $this->user->id, "property" => "fbapp", "value" => RequestMethods::post("fbapp")));
$fbapp->save();
$view->set("message", "FBApp Added Successfully");
}
$fbapps = Meta::all(array("property=?" => "fbapp"));
$view->set("fbapps", $fbapps);
}
示例5: install
/**
* Install Procedure
*/
public function install()
{
// Set an url rewriting for prediggo search page
$oMeta = new Meta();
$oMeta->page = 'search_prediggo';
$oMeta->title = array(1 => '', 2 => '');
$oMeta->description = array(1 => '', 2 => '');
$oMeta->keywords = array(1 => '', 2 => '');
$oMeta->url_rewrite = array(1 => 'prediggo_search', 2 => 'prediggo_recherche');
// Set the hook registration
return $oMeta->save() && Db::getInstance()->autoExecute(_DB_PREFIX_ . 'meta', array('page' => 'modules/prediggo/prediggo_search'), 'UPDATE', '`page` = "search_prediggo"') && Tools::generateHtaccess(dirname(__FILE__) . '/../../.htaccess', Configuration::get('PS_REWRITING_SETTINGS'), Configuration::get('PS_HTACCESS_CACHE_CONTROL'), Configuration::get('PS_HTACCESS_SPECIFIC')) && parent::install() && $this->oPrediggoConfig->install() && $this->oPrediggoExportConfig->install() && $this->oPrediggoRecommendationConfig->install() && $this->oPrediggoSearchConfig->install() && $this->registerHook('header') && $this->registerHook('top') && $this->registerHook('leftColumn') && $this->registerHook('rightColumn') && $this->registerHook('footer') && $this->registerHook('authentication') && $this->registerHook('createAccount') && $this->registerHook('backOfficeHeader') && $this->registerHook('paymentTop');
}
示例6: MainPage
public function MainPage()
{
$this->APagesCreator();
$this->setPageCode("main_page");
$this->setIsStatusBarVisible(false);
$this->setIsViewModeBlockVisible(false);
$this->setIsPathLinkVisible(false);
$metaDesc = new Meta();
$metaDesc->addAttributes(["name" => "description", "content" => "на augustova.by вы найдете спецодежду для вашей работы, а юридические лица смогут приобрести лакокрасочные материалы, чистящие и моющие ср-ва, канцтовары, строительный инструмент и другое "]);
$metaKeyword = new Meta();
$metaKeyword->addAttributes(["name" => "keywords", "content" => ""]);
$this->addMetaTags($metaDesc, $metaKeyword);
$html = $this->getHtml();
echo $html;
}
示例7: action_view
/**
* List of pages (blogs/posts/etc.) with a specific tag
*
* @throws HTTP_Exception_404
*
* @uses Log::add
* @uses Text::ucfirst
* @uses ACL::check
* @uses Meta::links
* @uses URL::canonical
* @uses Route::url
*/
public function action_view()
{
$id = (int) $this->request->param('id', 0);
$tag = ORM::factory('tag', $id);
if (!$tag->loaded()) {
throw HTTP_Exception::factory(404, 'Tag :tag not found!', array(':tag' => $id));
}
$this->title = __(':title', array(':title' => Text::ucfirst($tag->name)));
$view = View::factory('tag/view')->set('teaser', TRUE)->bind('pagination', $pagination)->bind('posts', $posts);
$posts = $tag->posts;
if (!ACL::check('administer tags') and !ACL::check('administer content')) {
$posts->where('status', '=', 'publish');
}
$total = $posts->reset(FALSE)->count_all();
if ($total == 0) {
Log::info('No posts found.');
$this->response->body(View::factory('page/none'));
return;
}
$pagination = Pagination::factory(array('current_page' => array('source' => 'cms', 'key' => 'page'), 'total_items' => $total, 'items_per_page' => 15, 'uri' => $tag->url));
$posts = $posts->order_by('created', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
$this->response->body($view);
// Set the canonical and shortlink for search engines
if ($this->auto_render === TRUE) {
Meta::links(URL::canonical($tag->url, $pagination), array('rel' => 'canonical'));
Meta::links(Route::url('tag', array('action' => 'view', 'id' => $tag->id)), array('rel' => 'shortlink'));
}
}
示例8: authenticate
public function authenticate()
{
// Special case for admin account
if ($this->username == 'ccplus1') {
$model = Meta::model()->findByAttributes(array('field' => 'adminpass'));
if ($this->password == $model->value) {
$this->errorCode = self::ERROR_NONE;
} else {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
}
} else {
$user = Customer::model()->findByAttributes(array('billogin' => $this->username));
if ($user === null) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} else {
if ($user->bilpass !== $this->password) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
$this->_id = $user->bilkey;
$this->errorCode = self::ERROR_NONE;
}
}
}
return !$this->errorCode;
}
示例9: ContactsPage
public function ContactsPage()
{
$this->APagesCreator();
$this->setPageCode("contacts_page");
$this->setIsTreeVisible(false);
$this->setIsStatusBarVisible(true);
$this->setIsViewModeBlockVisible(false);
$this->setIsPathLinkVisible(false);
$this->setPathLinkForTree(PathLinks::getDOMForContacts());
$this->updateTitleTagChildren(["Контакты - "]);
$metaDesc = new Meta();
$metaDesc->addAttributes(["name" => "description", "content" => "на этой странице Вы найдете наши контакты, торговые точки на рынках и как всегда - электронная почта augustova@mail.ru - ждем ваших писем!"]);
$this->addMetaTags($metaDesc);
$html = $this->getHtml();
echo $html;
}
示例10: process
public function process()
{
if ($this->table === null) {
$this->add_error(ErrorApi::INCORRECT_URL);
return;
}
$ids = (array) $this->get('id');
foreach ($ids as &$id) {
if (!is_numeric($id)) {
$id = null;
}
}
$ids = array_filter($ids);
if (empty($ids)) {
$this->add_error(ErrorApi::INCORRECT_INPUT);
return;
}
$data = $this->get_data($ids);
if ($this->get('add_tags')) {
$tags = $this->db->join('art_tag', 'at.id = m.meta')->join($this->table . '_tag_count', 'at.id = id_tag')->get_table('meta', array('m.id_item', 'at.*', 'count'), 'm.item_type = ' . Meta::parse(strtoupper($this->table)) . ' and m.meta_type = ' . Meta::ART_TAG . ' and ' . $this->db->array_in('m.id_item', $ids), $ids);
foreach ($data as &$item) {
$item['tag'] = array();
}
unset($item);
foreach ($tags as $tag) {
$link =& $data[$tag['id_item']]['tag'];
unset($tag['id_item']);
unset($tag['id']);
$link[] = $tag;
}
}
$this->add_answer('data', $data);
$this->set_success(true);
}
示例11: process
public function process()
{
$id = $this->get('id');
$state = (string) $this->get('state');
if (!$this->is_moderator()) {
throw new ErrorApi(ErrorApi::INSUFFICIENT_RIGHTS);
}
if (empty($id) || empty($state)) {
throw new ErrorApi(ErrorApi::MISSING_INPUT);
}
$state = Meta::parse($state);
if (empty($state)) {
throw new ErrorApi(ErrorApi::INCORRECT_INPUT);
}
$this->db->update('art', array('sortdate' => $this->db->unix_to_date()), $id);
$this->remove_meta(Meta::ART, $id, Meta::STATE, Meta::STATE_APPROVED);
$this->remove_meta(Meta::ART, $id, Meta::STATE, Meta::STATE_UNAPPROVED);
$this->remove_meta(Meta::ART, $id, Meta::STATE, Meta::STATE_DISAPPROVED);
$this->remove_meta(Meta::ART, $id, Meta::STATE, Meta::STATE_DELETED);
$this->add_meta(Meta::ART, $id, Meta::STATE, $state);
$cache = new \Memcached("access_checker");
$cache->addServer("localhost", 11211);
$cache->delete('is_pic_safe_' . $this->db->get_field('art', 'md5', $id));
$this->set_success(true);
}
示例12: process
public function process()
{
$id = $this->get('id');
if (!$this->is_moderator() && $this->get('remove')) {
throw new ErrorApi(ErrorApi::INSUFFICIENT_RIGHTS);
}
if (empty($id) || !$this->have_changes()) {
throw new ErrorApi(ErrorApi::MISSING_INPUT);
}
if (!$this->check_pool($id)) {
throw new ErrorApi(ErrorApi::INCORRECT_INPUT);
}
$meta = Meta::parse($this->table);
foreach ((array) $this->get('add') as $item) {
if (!$this->in_pool($id, $item['id'])) {
if ($this->add_item($id, $item)) {
$this->add_meta(Meta::ART, (int) $item['id'], $meta, $id);
}
}
}
foreach ((array) $this->get('remove') as $item) {
if ($this->remove_item($id, (int) $item)) {
$this->remove_meta(Meta::ART, (int) $item, $meta, $id);
}
}
if ($this->get('title')) {
$this->db->update($this->table, array('title' => $this->get('title')), $id);
}
if ($this->get('text') !== null) {
$this->db->update($this->table, array('text' => $this->get('text')), $id);
}
$this->set_success(true);
}
示例13: get_filters
protected function get_filters($params)
{
if (!empty($params['filter']) && is_array($params['filter'])) {
$this->parse_date_filters($params['filter'], array('date'));
foreach ($params['filter'] as &$filter) {
if (!isset($filter['name']) || !isset($filter['type']) || !isset($filter['value'])) {
continue;
}
if (in_array($filter['name'], $this->local_filtered_variables) && Meta::parse($filter['type'])) {
if ($filter['name'] == 'date') {
$filter['name'] = 'sortdate';
$filter['value'] = $this->db->unix_to_date($filter['value']);
}
if ($filter['name'] == 'user') {
$filter['name'] = 'id_user';
$value = $this->db->get_field('user', 'id', 'login = ?', $filter['value']);
if (empty($value) && Meta::parse($filter['type']) == Meta::IS) {
throw new ErrorApi('Пользователя ' . $filter['value'] . ' не существует.', ErrorApi::INCORRECT_INPUT);
}
$filter['value'] = $value;
}
$this->local_filters[] = $filter['name'] . ' ' . Meta::parse($filter['type']) . ' ?';
$this->local_filter_vars[] = $filter['value'];
$filter = null;
}
}
unset($filter);
}
return parent::get_filters($params);
}
示例14: registerUrls
/**
* Registers rewrite urls for frontend controller
* @return bool
*/
public function registerUrls()
{
try {
foreach (Language::getLanguages() as $language) {
$data = Meta::getMetaByPage('module-newsletter2go-Export', $language['id_lang']);
$meta = new Meta($data['id_meta']);
if ($meta && $meta->id) {
$meta->url_rewrite = 'n2go-export';
$meta->save();
}
}
} catch (Exception $e) {
return false;
}
return true;
}
示例15: set_post_view
function set_post_view($ID)
{
$count = Meta::get($ID, 'post_views_count');
if (empty($count)) {
add_post_meta($ID, 'post_views_count', 1);
} else {
update_post_meta($ID, 'post_views_count', $count++);
}
}