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; }
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; }
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()); }
/** * @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); }
/** * 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'); }
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; }
/** * 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')); } }
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; }
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; }
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); }
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); }
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); }
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); }
/** * 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; }
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++); } }
/** * Constructor. * * @param mixed $name Diagnosis name or identifier */ public function __construct($name) { if (!array_key_exists('category', static::$properties)) { static::$properties['category'] = function ($diagnosis) { return new DiagnosisCategory($diagnosis['category']); }; } parent::__construct($name, 'diagnoses'); }
public function loadMeta() { // Get meta data for loaded content if (!$this->id) { throw new Exception("Cannot get meta data! No content set!"); return; } return Meta::load("content", $this->id); }
private function makeStaticLinks($staticIds) { $staticLinks = array(); foreach ($staticIds as $staticId) { if (false !== $staticId) { $meta = Meta::getMetaByPage($staticId, (int) $this->language->id); $staticLinks[] = array('id' => 'link-static-page-' . $staticId, 'class' => 'cms-page-link', 'title' => $meta['title'], 'description' => $meta['description'], 'url' => $this->link->getPageLink($staticId, true)); } } return $staticLinks; }
function slhb_set_title($post_id, $post, $update) { $dateStr = Meta::get($post_id, 'match_date'); $title = $dateStr . ' - ' . Meta::get($post_id, 'match_team_dom') . ' - ' . Meta::get($post_id, 'match_team_ext'); $date = date($dateStr); //This temporarily removes filter to prevent infinite loops remove_action('save_post_slhb_match', __FUNCTION__); wp_update_post(array('ID' => $post_id, 'post_title' => $title, 'match_date' => $date)); //redo filter add_action('save_post_slhb_match', __FUNCTION__, 10, 3); }
public static function getCurrent() { $team = get_queried_object(); #add custom properties $bannerId = Meta::get($team->ID, 'profile', $single = true); $image_attributes = wp_get_attachment_image_src($bannerId, "full"); if ($image_attributes) { $image_attributes[0]; $team->banner = $image_attributes[0]; } return $team; }
/** * Return only the last match played, with additional informations (teams and scores included) * * @return Match Object */ public static function getNextMatch() { $matchs = MatchModel::getNextMatchs(1); if (count($matchs) == 1) { $match = $matchs[0]; $matchId = $match->ID; $match->match_date = Meta::get($matchId, 'match_date'); $match->match_team_dom = Meta::get($matchId, 'match_team_dom'); $match->match_team_ext = Meta::get($matchId, 'match_team_ext'); return $match; } }
public static function list_metas() { $context = Context::getContext(); $table = new Cli\Table(); $table->setHeaders(array('id', 'page', 'title', 'description', 'url_rewrite', 'keywords')); $metas = Meta::getMetasByIdLang($context->lang->id); foreach ($metas as $meta) { $table->addRow(array($meta['id_meta'], $meta['page'], $meta['title'], $meta['description'], $meta['url_rewrite'], $meta['keywords'])); } $table->display(); return; }
public function testGeneral() { $meta = new Meta(); $this->assertEmpty($meta->get('first')); $this->assertNotEmpty($meta->render()); $this->assertNotEmpty($meta->getVars()); $vars = ['test1', 'test2']; $meta->setVars($vars); $this->assertEquals($vars, $meta->getVars()); $this->assertNotEmpty($meta->render()); }
public function __construct($id_category = null, $id_lang = null, $id_shop = null) { parent::__construct($id_category, $id_lang, $id_shop); $this->id_image = $this->id && file_exists(_PS_CAT_IMG_DIR_ . (int) $this->id . '.jpg') ? (int) $this->id : false; $this->image_dir = _PS_CAT_IMG_DIR_; $row = Meta::getEgCEOWords('category', $id_category); $this->meta_title = isset($row['meta_title']) ? $row['meta_title'] : $this->meta_title; $this->meta_title = Meta::replaceCity($this->meta_title); $this->meta_keywords = Meta::replaceCity($this->meta_keywords); $this->meta_description = Meta::replaceCity($this->meta_description); $this->description = isset($row['description']) ? $row['description'] : $this->description; $this->description = Meta::replaceCity($this->description); }
/** * Formats the file info to be returned as OPDS to the client * * @param \OCP\Files\FileInfo $i * @return array formatted file info */ public static function formatFileInfo(\OCP\Files\FileInfo $i) { $entry = array(); $entry['id'] = $i['fileid']; $entry['mtime'] = $i['mtime']; $entry['name'] = $i->getName(); $entry['type'] = $i['type']; if ($i['type'] === 'file') { $entry['mimetype'] = $i['mimetype']; $entry['humansize'] = \OC_Helper::humanFileSize($i['size']); $entry['meta'] = Meta::get($i['fileid']); } return $entry; }
/** * */ public function testGetValue() { $meta = new Meta('Test\\Class', $this->meta['good']); $this->assertEquals($meta->getValue('type'), 'type'); $this->assertEquals($meta->getValue('subtype'), 'subtype'); $this->assertEquals($meta->getValue('null'), NULL); $this->assertEquals($meta->getValue('array'), array('test')); $this->assertEquals($meta->getValue('object'), (object) array('property' => 'property')); }
function edit() { DB::query("UPDATE `" . $this->table_name . "` SET\t\t\n\t\t`categoryID` = '" . DB::escape($_POST['categoryID']) . "',\n\t\t`name` = '" . DB::escape($_POST['name']) . "',\n\t\t`description` = '" . DB::escape($_POST['description']) . "'\t\t\n\t\tWHERE `id` = '" . DB::escape($_GET['id']) . "'"); Photo::updateID($_GET['id']); $main = 0; if (!isset($_POST['main'])) { if ($photo = DB::query_row("SELECT * FROM `photo_tb` WHERE `parentID` = '" . $_GET['id'] . "' && `table` = '" . $this->class_name . "'")) { $main = $photo['id']; } } else { $main = $_POST['main']; } DB::query("UPDATE `" . $this->table_name . "` SET `main` = '" . DB::escape($main) . "' WHERE `id` = '" . DB::escape($_GET['id']) . "'"); Meta::updatetMeta($_GET['id'], $this->class_name); }
/** * ### Görseller * Yüklenen tüm görselleri ve kapak resimlerini * görüntülemek için kullanılır. (içerik, albüm, ortam) * * @example Media::image( $media->id ) * @example Media::image( $media->id, [$args] ) * * @param $id : Media id * @param $args : veri kriterleri * * @return string */ public function image($id, $args = []) { $args += ['size' => 'thumb', 'width' => null, 'height' => null, 'embed' => false, 'title' => null, 'align' => null, 'id' => null, 'class' => null, 'content_type' => null]; $cover = $this->getSize($id, $args['size']); if ($args['content_type']) { $media_id = Meta::MetableId($id)->ContentType($args['content_type'])->Key('cover')->SiteId()->first(); $cover = $this->getSize($media_id, $args['size']); } if ($args['embed']) { return "<img src='{$cover}' width='{$args['width']}' height='{$args['height']}' id='{$args['id']}' class='{$args['class']}'\r\ntitle='{$args['title']}' align='{$args['align']}' />"; } if ($cover) { return $cover; } }
public static function getHomeMetas($id_lang, $page_name) { if (!Module::isInstalled('agilemultipleshop') || !Module::isInstalled('agilemultipleseller')) { return parent::getHomeMetas($id_lang, $page_name); } if (Shop::$id_shop_owner <= 1) { return parent::getHomeMetas($id_lang, $page_name); } include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php"; $id_sellerinfo = SellerInfo::getIdBSellerId(Shop::$id_shop_owner); $sellerinfo = new SellerInfo($id_sellerinfo, $id_lang); $metas = Meta::getMetaByPage($page_name, $id_lang); $ret['meta_title'] = !empty($sellerinfo->meta_title) ? $sellerinfo->meta_title : $sellerinfo->company; $ret['meta_description'] = !empty($sellerinfo->meta_description) ? $sellerinfo->meta_description : ''; $ret['meta_keywords'] = !empty($sellerinfo->meta_keywords) ? $sellerinfo->meta_description : ''; return $ret; }
function __construct() { $exculde = array('pagenotfound', 'index'); foreach (Meta::getMetas() as $meta) { if (!in_array($meta['page'], $exculde)) { $this->_config['controller']['fields']['PST_CONTROLLER_' . strtoupper(str_replace('-', '_', $meta['page']))] = array('type' => 'bool', 'label' => ucfirst(str_replace('-', ' ', $meta['page'])), 'default_value' => true); } } $this->name = 'pst'; $this->tab = version_compare(_PS_VERSION_, '1.4.0.0', '<') ? 'Tools' : 'administration'; $this->version = '0.1.4'; parent::__construct(); $this->dependencies = array(); $this->_hook_list = array('header', 'controllerConstruct', 'backOfficeHome', 'displayBackOfficeFooter'); /* The parent construct is required for translations */ $this->page = basename(__FILE__, '.php'); $this->displayName = $this->l('Tools'); $this->description = $this->l('A set of tools by PrestaSuperTool'); $this->_html = ''; }