Пример #1
0
 /**
  * Sets Dublin Core Meta Tags
  * @author Howard <*****@*****.**>
  * @return boolean
  */
 public function dublincore()
 {
     $settings = wpl_global::get_settings();
     $dc_status = isset($settings['dc_status']) ? $settings['dc_status'] : false;
     /** check status of geo tags **/
     if (!$dc_status) {
         return false;
     }
     $current_link_url = wpl_global::get_full_url();
     $html = wpl_html::getInstance();
     /** WPL views and WordPress views (Page/Post) **/
     if (trim($this->view) != '' and $dc_status == 2 or $dc_status == 1) {
         if (trim($settings['dc_coverage']) != '') {
             $html->set_custom_tag('<meta name="DC.coverage" content="' . $settings['dc_coverage'] . '" />');
         }
         if (trim($settings['dc_contributor']) != '') {
             $html->set_custom_tag('<meta name="DC.contributor" content="' . $settings['dc_contributor'] . '" />');
         }
         if (trim($settings['dc_publisher']) != '') {
             $html->set_custom_tag('<meta name="DC.publisher" content="' . $settings['dc_publisher'] . '" />');
         }
         if (trim($settings['dc_copyright']) != '') {
             $html->set_custom_tag('<meta name="DC.rights" content="' . $settings['dc_copyright'] . '" />');
         }
         if (trim($settings['dc_source']) != '') {
             $html->set_custom_tag('<meta name="DC.source" content="' . $settings['dc_source'] . '" />');
         }
         if (trim($settings['dc_relation']) != '') {
             $html->set_custom_tag('<meta name="DC.relation" content="' . $settings['dc_relation'] . '" />');
         }
         $html->set_custom_tag('<meta name="DC.type" content="Text" />');
         $html->set_custom_tag('<meta name="DC.format" content="text/html" />');
         $html->set_custom_tag('<meta name="DC.identifier" content="' . $current_link_url . '" />');
         $locale = apply_filters('plugin_locale', get_locale(), WPL_TEXTDOMAIN);
         $html->set_custom_tag('<meta name="DC.language" scheme="RFC1766" content="' . $locale . '" />');
     }
     if ($this->view == 'property_show') {
         $proeprty_id = wpl_request::getVar('pid');
         $property_data = wpl_property::get_property_raw_data($proeprty_id);
         $user_data = (array) wpl_users::get_user($property_data['user_id']);
         $html->set_custom_tag('<meta name="DC.title" content="' . $this->property_page_title . '" />');
         $html->set_custom_tag('<meta name="DC.subject" content="' . $this->property_page_title . '" />');
         $html->set_custom_tag('<meta name="DC.description" content="' . $this->property_description . '" />');
         $html->set_custom_tag('<meta name="DC.date" content="' . $property_data['add_date'] . '" />');
         $html->set_custom_tag('<meta name="DC.creator" content="' . $user_data['data']->user_login . '" />');
     } elseif ($this->view == 'profile_show') {
         $user_id = wpl_request::getVar('uid');
         $user_data = (array) wpl_users::get_user($user_id);
         $html->set_custom_tag('<meta name="DC.title" content="' . $this->user_title . '" />');
         $html->set_custom_tag('<meta name="DC.subject" content="' . $this->user_title . '" />');
         $html->set_custom_tag('<meta name="DC.description" content="' . $this->user_description . '" />');
         $html->set_custom_tag('<meta name="DC.date" content="' . $user_data['data']->user_registered . '" />');
         $html->set_custom_tag('<meta name="DC.creator" content="' . $user_data['data']->user_login . '" />');
     } elseif (is_single()) {
         $post_author_id = wpl_global::get_post_field('post_author');
         $author_username = wpl_global::get_the_author_meta('user_login', $post_author_id);
         $html->set_custom_tag('<meta name="DC.title" content="' . wpl_global::get_the_title() . '" />');
         $html->set_custom_tag('<meta name="DC.subject" content="' . wpl_global::get_the_title() . '" />');
         $html->set_custom_tag('<meta name="DC.date" content="' . wpl_global::get_the_date() . '" />');
         $html->set_custom_tag('<meta name="DC.creator" content="' . $author_username . '" />');
     }
 }