activate(); else $yarpp->upgrade_check(); // check to see that templates are in the right place if ( !count($yarpp->admin->get_templates()) ) { yarpp_set_option( array( 'template' => false, 'rss_template' => false) ); } // 3.3: move version checking here, in PHP: if ( current_user_can('update_plugins' ) ) { $yarpp_version_info = $yarpp->version_info(); // these strings are not localizable, as long as the plugin data on wordpress.org // cannot be. $slug = 'yet-another-related-posts-plugin'; $plugin_name = 'Yet Another Related Posts Plugin'; $file = basename(YARPP_DIR) . '/yarpp.php'; if ( $yarpp_version_info['result'] == 'new' ) { // make sure the update system is aware of this version $current = get_site_transient( 'update_plugins' ); if ( !isset( $current->response[ $file ] ) ) { delete_site_transient( 'update_plugins' ); wp_update_plugins(); } echo '

'; $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $slug . '&TB_iframe=true&width=600&height=800'); printf( __('There is a new version of %1$s available. View version %4$s details or update automatically.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $yarpp_version_info['current']['version'], wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file) ); echo '

'; } else if ( $yarpp_version_info['result'] == 'newbeta' ) { echo '

'; printf(__("There is a new beta (%s) of Yet Another Related Posts Plugin. You can download it here at your own risk.","yarpp"), $yarpp_version_info['beta']['version'], $yarpp_version_info['beta']['url']); echo '

'; } } if (isset($_POST['myisam_override'])) { yarpp_set_option('myisam_override',1); echo "
" .__("The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria.",'yarpp') ."
"; } if ( !yarpp_get_option('myisam_override') ) { $yarpp_check_return = $yarpp->myisam_check(); if ($yarpp_check_return !== true) { // if it's not *exactly* true echo "
" .sprintf(__("YARPP's \"consider titles\" and \"consider bodies\" relatedness criteria require your %s table to use the MyISAM storage engine, but the table seems to be using the %s engine. These two options have been disabled.",'yarpp'),$wpdb->posts,$yarpp_check_return) ."
" .sprintf(__("To restore these features, please update your %s table by executing the following SQL directive: ALTER TABLE `%s` ENGINE = MyISAM; . No data will be erased by altering the table's engine, although there are performance implications.",'yarpp'),$wpdb->posts,$wpdb->posts) ."
" .sprintf(__("If, despite this check, you are sure that %s is using the MyISAM engine, press this magic button:",'yarpp'),$wpdb->posts) ."
" ."
" ."
"; $weight = yarpp_set_option('weight'); unset($weight['title']); unset($weight['body']); yarpp_set_option(array('weight' => $weight)); $yarpp->myisam = false; } } if ( $yarpp->myisam && !$yarpp->enabled() ) { echo '
'; if ( $yarpp->activate() ) { _e('The YARPP database had an error but has been fixed.','yarpp'); } else { _e('The YARPP database has an error which could not be fixed.','yarpp'); printf(__('Please try manual SQL setup.','yarpp'), 'http://mitcho.com/code/yarpp/sql.php?prefix='.urlencode($wpdb->prefix)); } echo '
'; } if (isset($_POST['update_yarpp'])) { $new_options = array(); foreach ($yarpp->default_options as $option => $default) { if ( is_bool($default) ) $new_options[$option] = isset($_POST[$option]); // @todo: do we really want to stripslashes here anymore? if ( (is_string($default) || is_int($default)) && isset($_POST[$option]) && is_string($_POST[$option]) ) $new_options[$option] = stripslashes($_POST[$option]); } if ( isset($_POST['weight']) ) { $new_options['weight'] = array(); $new_options['require_tax'] = array(); foreach ( (array) $_POST['weight'] as $key => $value) { if ( $value == 'consider' ) $new_options['weight'][$key] = 1; if ( $value == 'consider_extra' ) $new_options['weight'][$key] = YARPP_EXTRA_WEIGHT; } foreach ( (array) $_POST['weight']['tax'] as $tax => $value) { if ( $value == 'consider' ) $new_options['weight']['tax'][$tax] = 1; if ( $value == 'consider_extra' ) $new_options['weight']['tax'][$tax] = YARPP_EXTRA_WEIGHT; if ( $value == 'require_one' ) { $new_options['weight']['tax'][$tax] = 1; $new_options['require_tax'][$tax] = 1; } if ( $value == 'require_more' ) { $new_options['weight']['tax'][$tax] = 1; $new_options['require_tax'][$tax] = 2; } } } $new_options['recent'] = isset($_POST['recent_only']) ? $_POST['recent_number'] . ' ' . $_POST['recent_units'] : false; if ( isset($_POST['exclude']) ) $new_options['exclude'] = implode(',',array_keys($_POST['exclude'])); else $new_options['exclude'] = ''; $new_options['template'] = isset($_POST['use_template']) ? $_POST['template_file'] : false; $new_options['rss_template'] = isset($_POST['rss_use_template']) ? $_POST['rss_template_file'] : false; $new_options = apply_filters( 'yarpp_settings_save', $new_options ); yarpp_set_option($new_options); echo '

'.__('Options saved!','yarpp').'

'; } ?>

mitcho (Michael 芳貴 Erlewine)','yarpp'), 'http://mitcho.com/');?>