. */ if ( !class_exists( 'AioseoMultibyteDescriptions' ) ) { class AioseoMultibyteDescriptions { var $i18n_domain = 'aioseo-multibyte-descriptions'; // wp_opions table's option_name column value var $option_name = "aioseo_multibyte_descriptions" ; var $options; var $default_options = array( 'descriptions_length' => '120', ); var $plugin_dir_name; var $plugin_dir; var $plugin_dir_url; var $blog_encoding; var $has_mbfunctions; var $aioseop_options; function __construct() { $dirs = explode(DIRECTORY_SEPARATOR, dirname(__FILE__)); // aioseo-multibyte-descriptions $this->plugin_dir_name = array_pop($dirs); // /path/to/aioseo-multibyte-descriptions $this->plugin_dir = WP_PLUGIN_DIR .'/'. $this->plugin_dir_name; // http://sample.com/path/to/aioseo-multibyte-descriptions $this->plugin_dir_url = WP_PLUGIN_URL .'/'. $this->plugin_dir_name; //Localization $locale = get_locale(); load_plugin_textdomain($this->i18n_domain, $this->plugin_dir. '/locales/', $this->plugin_dir_name. '/locales/' ); $this->blog_encoding = get_option('blog_charset'); $this->has_mbfunctions = $this->mbfunctions_exist(); //plugin deactive if(!$this->has_mbfunctions ) { $plugin = plugin_basename(__FILE__); $current = get_option('active_plugins'); $key = array_search($plugin, $current); if(false !== $key && null !== $key) { array_splice($current, $key, 1); update_option('active_plugins', $current); add_action('admin_notices', 'warning'); return; } } $this->load_options(); add_action('admin_menu', array(&$this, 'add_admin_option_page')); add_filter( 'plugin_action_links_'. plugin_basename(__FILE__), array(&$this, 'add_plugin_action_links')); add_filter('aioseop_description', array(&$this, 'get_multibyte_post_description')); } function get_multibyte_post_description($description) { global $wp_query; $post = $wp_query->get_queried_object(); if ( $this->is_almost_ascii($description, $this->blog_encoding) && strlen($description) > $this->options['descriptions_length'] ) { return $description; }else { $this->trim_excerpt_without_filters_full_length($description); $description = mb_substr($post->post_content, 0, $this->options['descriptions_length'], $this->blog_encoding); $description = preg_replace("/\s\s+/", " ", $description); return $description; } } /** * Retrieves the plugin's options from the database. * * * @return boolean */ function load_options() { if( false === ( $options = get_option( $this->option_name) ) ) { $this->options = $this->default_options; return false; } else { $this->options = $options; return true; } } /** * delete the plugin's options from the database. * * */ function delete_options() { return delete_option($this->option_name); } /** * save the options value to the WordPress database * * * @return boolean true if the save was successful. */ function save_options( ) { return update_option( $this->option_name, $this->options ); } // Add option page function add_admin_option_page() { $option_page = add_options_page( __('Aioseo Multibyte Descriptions Option', $this->i18n_domain), __('Aioseo Multibyte Descriptions', $this->i18n_domain), 8, //'manage_options', basename(__FILE__), array(&$this, 'admin_option_page') ); add_action('admin_print_styles-'. $option_page, array(&$this,'add_admin_print_styles')); add_action('admin_print_scripts-'. $option_page, array(&$this,'add_admin_print_scripts')); // add_action('admin_notices', array (&$this,"add_admin_notices")); add_action('in_admin_footer', array (&$this,"add_admin_notices")); } /** * Admin option page * * @return void */ function admin_option_page() { ?>

i18n_domain); ?>

i18n_domain); ?>


i18n_domain); ?>

1. i18n_domain); ?>

2. i18n_domain); ?>


i18n_domain); ?>

i18n_domain); ?>

options['descriptions_length'] = $_POST['descriptions_length']; $this->save_options(); ?>

i18n_domain); ?>

delete_options(); $this->load_options(); endif; $this->aioseop_options = get_option('aioseop_options'); if( 'on' != $this->aioseop_options["aiosp_generate_descriptions"] ): ?>

i18n_domain); ?>
i18n_domain); ?> All in One SEO Option

'.__('Settings').''; array_unshift($actions, $link); return $actions; } //from //Plugin Name: All in One SEO Pack //Plugin URI: http://semperfiwebdesign.com //Version: 1.6.12.1 //Author: Michael Torbert function trim_excerpt_without_filters_full_length($text) { $text = str_replace(']]>', ']]>', $text); $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text ); $text = strip_tags($text); return trim(stripcslashes($text)); } // from // WP Multibyte Patch // Plugin URI: http://eastcoder.com/code/wp-multibyte-patch/ // Author: tenpura // Version: 1.1.6 function mbfunctions_exist() { return ( function_exists('mb_convert_encoding') && function_exists('mb_convert_kana') && function_exists('mb_detect_encoding') && function_exists('mb_strcut') && function_exists('mb_strlen') && function_exists('mb_substr') ) ? true : false; } // from // WP Multibyte Patch // Plugin URI: http://eastcoder.com/code/wp-multibyte-patch/ // Author: tenpura // Version: 1.1.6 function is_almost_ascii($string, $encoding) { return (90 < round(@(mb_strlen($string, $encoding) / strlen($string)) * 100)) ? true : false; } } } if ( class_exists( 'AioseoMultibyteDescriptions' ) ) { $aioseo_multibyte_descriptions = new AioseoMultibyteDescriptions(); } ?>