コード例 #1
0
 /**
  * Instance.
  *
  * An global instance of the class. Used to retrieve the instance
  * to use on other files/plugins/themes.
  *
  * @since 1.0.0
  *
  * @return object Instance of the class.
  */
 public static function instance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
    /**
     * Toggle note.
     *
     * Toggle note type, from 'regular note' to 'list note' or vice versa.
     *
     * @since 1.0.0
     */
    public function wpdn_toggle_note()
    {
        $note = get_post($_POST['post_id']);
        $content = apply_filters('wpdn_content', $note->post_content);
        $colors = apply_filters('wpdn_colors', array('white' => '#fff', 'red' => '#f7846a', 'orange' => '#ffbd22', 'yellow' => '#eeee22', 'green' => '#bbe535', 'blue' => '#66ccdd', 'black' => '#777777'));
        $note_meta = WP_Dashboard_Notes::wpdn_get_note_meta($note->ID);
        ?>
		<style>
			#note_<?php 
        echo $note->ID;
        ?>
 { background-color: <?php 
        echo $note_meta['color'];
        ?>
; }
			#note_<?php 
        echo $note->ID;
        ?>
 .hndle { border: none; }
		</style>
		<?php 
        if ($_POST['note_type'] == 'regular') {
            require plugin_dir_path(__FILE__) . 'templates/note.php';
        } else {
            require plugin_dir_path(__FILE__) . 'templates/note-list.php';
        }
        die;
    }