Ignore:
Timestamp:
Apr 4, 2020, 8:28:29 PM (4 years ago)
Author:
ddtddt
Message:

[Meta_OG] add site_name:og

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/meta_og/main.inc.php

    r32069 r32072  
    3333$conf['mogsize'] > for size image
    3434$conf['moglocal'] > for local:og
     35$conf['mogsitename'] > for og:site_name
    3536
    3637type
     
    9798  if(isset($images)){
    9899      $metaog['metaogimage']=PWG_DERIVATIVE_DIR.substr($images['path'], 2, -4)."-".$conf['mogsize'].substr($images['path'],-4);
    99           if (file_exists($metaog['metaogimage'])){
     100          if (file_exists($metaog['metaogimage']) AND $conf['mogsize']!='original'){
    100101                $metaog['metaogimage']=$protocol.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,11).PWG_DERIVATIVE_DIR.substr($images['path'], 2, -4)."-".$conf['mogsize'].substr($images['path'],-4);
    101102          }else{
     
    112113
    113114  $images = pwg_db_fetch_assoc(pwg_query("SELECT * FROM " . IMAGES_TABLE . " WHERE id = '".$page['image_id']."';"));
    114   $metaog['type']="image";
     115  $metaog['type']="website";
    115116  if(empty($metaog['metaogtitle'])){$metaog['metaogtitle']=$images['name'];}
    116117  if(empty($metaog['metaogdescription'])){$metaog['metaogdescription']=$images['comment'];}
     
    120121  }
    121122  $metaog['metaogimage']=PWG_DERIVATIVE_DIR.substr($images['path'], 2, -4)."-".$conf['mogsize'].substr($images['path'],-4);
    122   if (file_exists($metaog['metaogimage'])){
     123  if (file_exists($metaog['metaogimage']) AND $conf['mogsize']!='original'){
    123124        $metaog['metaogimage']=$protocol.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,11).PWG_DERIVATIVE_DIR.substr($images['path'], 2, -4)."-".$conf['mogsize'].substr($images['path'],-4);
    124125  }else{
     
    135136        $images = pwg_db_fetch_assoc(pwg_query("SELECT id,path FROM " . IMAGES_TABLE . " WHERE id = '".$metaog['metaogimage']."';"));
    136137      $metaog['metaogimage']=PWG_DERIVATIVE_DIR.substr($images['path'], 2, -4)."-".$conf['mogsize'].substr($images['path'],-4);
    137           if (file_exists($metaog['metaogimage'])){
     138          if (file_exists($metaog['metaogimage']) AND $conf['mogsize']!='original'){
    138139                $metaog['metaogimage']=$protocol.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,11).PWG_DERIVATIVE_DIR.substr($images['path'], 2, -4)."-".$conf['mogsize'].substr($images['path'],-4);
    139140          }else{
     
    149150        $metaog['metaogimage']='';
    150151  }
    151   if(!empty($metaog['metaogimage'])){
     152  if(!empty($metaog['metaogimage']) AND $conf['mogsize']!='original'){
    152153        $images = pwg_db_fetch_assoc(pwg_query("SELECT id,path FROM " . IMAGES_TABLE . " WHERE id = '".$metaog['metaogimage']."';"));
    153154      $metaog['metaogimage']=PWG_DERIVATIVE_DIR.substr($images['path'], 2, -4)."-".$conf['mogsize'].substr($images['path'],-4);
     
    164165  $metaog['metaogdescription']=$template->get_template_vars('INFO_FILE');
    165166}
     167
    166168 
    167169 
     
    187189    // og:image
    188190  if (!empty($metaog['metaogimage'])) {
     191        $metaog['metaogimagetype']=substr($metaog['metaogimage'],-3);
     192        if($metaog['metaogimagetype']=='jpg'){$metaog['metaogimagetype']='jpeg';}
    189193    $template->append('head_elements', '<meta property="og:image" content="' . $metaog['metaogimage'] . '">');
     194        $template->append('head_elements', '<meta property="og:image:type" content="image/' . $metaog['metaogimagetype'] . '">');
    190195  }
    191196 
     
    199204  }
    200205 
     206      // og:site_name
     207  if (!empty($conf['mogsitename'])) {
     208    $template->append('head_elements', '<meta property="og:site_name" content="' . $conf['mogsitename'] . '">');
     209  }
     210 
     211 
    201212}
    202213
Note: See TracChangeset for help on using the changeset viewer.