ID, 'prompt', true);
if (empty($promptext)) {
global $convo_starter;
$promptext = $convo_starter->defaultPromptText(); // "What do you think about this post?";
}
?>
ID ))
return $post->ID;
} else {
if ( !current_user_can( 'edit_post', $post->ID ))
return $post->ID;
}
$mydata['prompt'] = $_POST['promptext'];
foreach ($mydata as $key => $value) { //Let's cycle through the $mydata array!
if( $post->post_type == 'revision' ) return; //don't store custom data twice
$value = implode(',', (array)$value); //if $value is an array, make it a CSV (unlikely)
if(get_post_meta($post->ID, $key, FALSE)) { //if the custom field already has a value
update_post_meta($post->ID, $key, $value);
} else { //if the custom field doesn't have a value
add_post_meta($post->ID, $key, $value);
}
if(!$value) delete_post_meta($post->ID, $key); //delete if blank
}
}
/* Use the admin_menu action to define the custom boxes */
add_action('admin_menu', 'pj_convo_starter_add_model_meta');
add_action('save_post', 'pj_convo_starter_save_model_meta', 1, 2);
add_action('activate_conversation-starter/pj-convo.php', array(&$convo_starter, 'activateMe'));
add_action('wp_head', 'pj_convo_starter_head_intercept');
add_action('wp_footer', 'pj_convo_starter_foot_intercept');
function pj_convo_starter_head_intercept()
{
echo '';
}
function pj_convo_starter_foot_intercept ()
{
global $post;
echo '';
}
/*----------------------------
FRONTEND CSS & JS files
*/
function pj_convo_parse_request($wp) {
// only process requests with "my-plugin=ajax-handler"
if (array_key_exists('conversation-starter', $wp->query_vars)
&& $wp->query_vars['conversation-starter'] == 'frontend_css') {
include(CONVO_DIR.'/stylesheets/frontend.php');
die();
} else if (array_key_exists('conversation-starter', $wp->query_vars)
&& $wp->query_vars['conversation-starter'] == 'frontend_js') {
include(CONVO_DIR.'/javascripts/frontend.php');
die();
}
}
add_action('wp', 'pj_convo_parse_request');
function pj_convo_query_vars($vars) {
$vars[] = 'conversation-starter';
$vars[] = 'convo-id';
return $vars;
}
add_filter('query_vars', 'pj_convo_query_vars');
/*----------------------------
ADMIN Page functionality
*/
require ('PluginCore/extend.php');
?>