Example #1
0
 public function main_settings()
 {
     if (isset($_POST['wpog_options'])) {
         NY_OG_Main_Admin::set_options($_POST['wpog_options']);
     }
     require_once 'main.admin.form.php';
 }
Example #2
0
<?php

/**
Plugin name: WP Open Graph
Plugin URI: http://wordpress.org/plugins/wp-open-graph/
Description: WP Open Graph allows custom input open graph meta data to any content type. (Or use data from All-In-One-Seo-Pack or Wordpress-Seo-By-Yoast)
Version: 1.5
Author: Nick Yurov
Author URI: http://nickyurov.com
*/
//Main Admin Setting
require_once 'main.admin.class.php';
NY_OG_Main_Admin::init();
//Taxonomy Admin Setting
//require_once 'taxonomy.admin.class.php';
//NY_OG_Taxonomy_Admin::init();
//Print og data
require_once 'output.class.php';
global $NY_OG_Output;
$NY_OG_Output = new NY_OG_Output();
//Admin
require_once 'admin.class.php';
$NY_OG_Admin = new NY_OG_Admin();
Example #3
0
 public function _add_image($admin_img = false)
 {
     $default_image = NY_OG_Main_Admin::option('image');
     if (is_front_page()) {
         $home_image = NY_OG_Main_Admin::option('home_image');
         if ($home_image) {
             $this->_metas['og:image'] = $home_image;
         } else {
             if ($default_image) {
                 $this->_metas['og:image'] = $default_image;
                 return $default_image;
             }
         }
     } else {
         if (is_home()) {
             $blog_image = NY_OG_Main_Admin::option('blog_image');
             if ($home_image) {
                 $this->_metas['og:image'] = $blog_image;
             } else {
                 if ($default_image) {
                     $this->_metas['og:image'] = $default_image;
                     return $default_image;
                 }
             }
         } else {
             if (has_post_thumbnail()) {
                 $this->_metas['og:image'] = wp_get_attachment_url(get_post_thumbnail_id());
                 if ($admin_img) {
                     $img = wp_get_attachment_image(get_post_thumbnail_id(), array(50, 50));
                     return $img;
                 }
                 return wp_get_attachment_url(get_post_thumbnail_id());
             } else {
                 $attachment = get_posts(array('numberposts' => 1, 'post_type' => 'attachment', 'post_parent' => get_the_ID()));
                 if ($attachment) {
                     $this->_metas['og:image'] = wp_get_attachment_thumb_url($attachment[0]->ID);
                     if ($admin_img) {
                         $img = wp_get_attachment_image($attachment[0]->ID, array(50, 50));
                         return $img;
                     }
                     return wp_get_attachment_thumb_url($attachment[0]->ID);
                 } else {
                     if ($default_image) {
                         $this->_metas['og:image'] = $default_image;
                         if ($admin_img) {
                             return '<img width="50" src="' . $default_image . '" />';
                         }
                         return $default_image;
                     } else {
                         return false;
                     }
                 }
                 wp_reset_query();
             }
         }
     }
 }
Example #4
0
</textarea>
	</td>
	<tr>
		<td>
			<label for="og_blog_type">Type:</label><br />
			<em>(article / blog / website etc.)</em>
		</td>
		<td>
			<input type="text" style="width:510px;" id="og_blog_type" name="wpog_options[blog_type]" value="<?php 
echo NY_OG_Main_Admin::option('blog_type');
?>
" size="90" />
		</td>
	</tr>
	<tr>
		<td><label for="og_blog_image">Image URL:</label></td>
		<td>
			<input type="text" style="width:510px;" id="og_blog_image" name="wpog_options[blog_image]" value="<?php 
echo NY_OG_Main_Admin::option('blog_image');
?>
" size="90" />
		</td>
	</tr>
</table>
<p class="submit">
      <input type="submit" class="button-primary" value="<?php 
_e('Submit');
?>
" />
</p>
</form>