public function add_settings_metabox($post) { $checked = AceCourseExercise::is_exercise($post->ID) ? 'checked="checked" ' : ''; if ($post->post_type == 'page') { $label = __('Only show the user\'s own comments on this page', ACE_COURSE_TEXT_DOMAIN); } else { // 'post' $label = __('Treat comments as answers to an <strong>Ace Course exercise</strong>; only show the user\'s own comments', ACE_COURSE_TEXT_DOMAIN); } $exercise_id = AceCourseExercise::TAG_EXERCISE; $nonce_id = AceCourseCore::TAG_NONCE; $nonce = AceCourseCore::get_nonce(); echo <<<EOT2 <div> <label for="{$exercise_id}"><input type="checkbox" id="{$exercise_id}" name="{$exercise_id}" value="1" {$checked} />{$label}</label> <input type="hidden" name="{$nonce_id}" value="{$nonce}" /> </div> EOT2; }
<?php namespace nl\bransom\wordpress; global $post; $permalink = get_permalink($post->ID); $exercise_classes = ''; $image_url = $instance['todo_visual']; $ace_exercise = AceCourseExercise::wrap($post->ID); if ($ace_exercise != NULL) { $exercise_classes .= $ace_exercise->get_css_classes(); if ($ace_exercise->get_status() == AceCourseExercise::DONE) { $image_url = $instance['done_visual']; } } if (strpos($image_url, '/') === FALSE) { $image_url = ACE_COURSE_PLUGIN_URL . "assets/" . $image_url; } echo <<<EOT <div class="{$exercise_classes}"> <a href="{$permalink}">{$post->post_title}<img src="{$image_url}" align="right" style="vertical-align: sub; width: 20px;" /></a> </div> EOT ;
public function add_exercise_css_classes($classes) { if (in_array('type-post', $classes)) { global $post; $ace_exercise = AceCourseExercise::wrap($post->ID); if ($ace_exercise != NULL) { $this->ace_user->add_css_classes($classes); $ace_exercise->add_css_classes($classes); } } return $classes; }