Exemplo n.º 1
0
function bm_list_recent()
{
    global $BMRECENTBOOKS;
    $books = bm_get_books();
    if (!empty($books)) {
        echo '<ul>';
        $books = array_slice($books, 0, $BMRECENTBOOKS, true);
        foreach ($books as $book) {
            $url = bm_get_url('book') . $book->slug;
            $title = strip_tags(strip_decode($book->title));
            echo "<li><a href=\"{$url}\">{$title}</a></li>";
        }
        echo '</ul>';
    }
}
Exemplo n.º 2
0
function bm_show_page($index = 0)
{
    global $BMBOOKSPERPAGE, $BMSHOWEXCERPT;
    $books = bm_get_books();
    $pages = array_chunk($books, intval($BMBOOKSPERPAGE), true);
    if (is_numeric($index) && $index >= 0 && $index < sizeof($pages)) {
        $books = $pages[$index];
    } else {
        $books = array();
    }
    if (!empty($books)) {
        foreach ($books as $book) {
            bm_show_book($book->slug, $BMSHOWEXCERPT == 'Y');
        }
        if (sizeof($pages) > 1) {
            bm_show_navigation($index, sizeof($pages));
        }
    } else {
        echo '<p>' . i18n_r('books_manager/NO_BOOKS') . '</p>';
    }
}
Exemplo n.º 3
0
function bm_admin_panel()
{
    global $PRETTYURLS, $BMPRETTYURLS;
    $books = bm_get_books(true);
    ?>
  <h3 class="floated"><?php 
    i18n('books_manager/PLUGIN_NAME');
    ?>
</h3>
  
  <div class="edit-nav clearfix">
    <a href="#" id="filter-button" ><?php 
    i18n('FILTER');
    ?>
</a>
    
    <a href="load.php?id=books_manager&edit"><?php 
    i18n('books_manager/NEW_BOOK');
    ?>
</a>
    
    <a href="load.php?id=books_manager&settings"><?php 
    i18n('books_manager/SETTINGS');
    ?>
</a>
    
  </div>
  
  <?php 
    if (!empty($books)) {
        ?>
    <div id="filter-search">
      <form>
        <input type="text" class="text" id="tokens" placeholder="<?php 
        echo lowercase(i18n_r('FILTER'));
        ?>
..." />
        &nbsp;
        <a href="load.php?id=books_manager" class="cancel"><?php 
        i18n('books_manager/CANCEL');
        ?>
</a>
      </form>
    </div>
    <table id="books" class="highlight">
    <tr>

      <th><?php 
        i18n('books_manager/BOOK_TITLE');
        ?>
</th>
      <th style="text-align: right;"><?php 
        i18n('books_manager/DATE');
        ?>
</th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
    <?php 
        foreach ($books as $book) {
            $title = cl($book->title);
            $date = shtDate($book->date);
            $url = bm_get_url('book') . $book->slug;
            ?>
      <tr>
        <td class="booktitle">
           <a href="load.php?id=books_manager&edit=<?php 
            echo $book->slug;
            ?>
" title="<?php 
            i18n('books_manager/EDIT_BOOK');
            ?>
: <?php 
            echo $title;
            ?>
">
            <?php 
            echo $title;
            ?>
          </a>
        </td>
        <td style="text-align: right;">
          <span><?php 
            echo $date;
            ?>
</span>
        </td>
        <td style="width: 20px;text-align: center;">
          <?php 
            if ($book->private == 'Y') {
                echo '<span style="color: #aaa;">P</span>';
            }
            ?>
        </td>
        <td class="secondarylink">

          <a href="<?php 
            echo $url;
            ?>
" target="_blank" title="<?php 
            i18n('books_manager/VIEW_BOOK');
            ?>
: <?php 
            echo $title;
            ?>
">
            #
          </a>
          
        </td>
        <td class="delete">
         <a href="#" class="delconfirm" title="<?php 
            i18n('books_manager/DELETE_BOOK');
            ?>
: <?php 
            echo $title;
            ?>
?">
            X
          </a>
        
        </td>
      </tr>
      <?php 
        }
        ?>
    </table>
    <p>
      <b><?php 
        echo count($books);
        ?>
</b>
        <?php 
        i18n('books_manager/BOOKS');
        ?>
     
       <?php 
        'books_manager';
        ?>
    </p>

    <script>
    $(document).ready(function() {
      // filter button opens up filter dialog
      $("#filter-button").live("click", function($e) {
        $e.preventDefault();
        $("#filter-search").slideToggle();
        $(this).toggleClass("current");
        $("#filter-search #tokens").focus();
      });
      // ignore enter key in filter form
      $("#filter-search #tokens").keydown(function($e) {
        if($e.keyCode == 13) {
          $e.preventDefault();
        }
      });
      // close filter dialog on cancel
      $("#filter-search .cancel").live("click", function($e) {
        $e.preventDefault();
        $("#posts tr").show();
        $('#filter-button').toggleClass("current");
        $("#filter-search #tokens").val("");
        $("#filter-search").slideUp();
      });
      // filter table, see:
      // http://kobikobi.wordpress.com/2008/09/15/using-jquery-to-filter-table-rows/
      $("#posts tr:has(td.posttitle)").each(function() {
        var t = $(this).find('td.posttitle').text().toLowerCase();
        $("<td class='indexColumn'></td>")
        .hide().text(t).appendTo(this);
      });
      $("#tokens").keyup(function() {
        var s = $(this).val().toLowerCase().split(" ");
      $("#posts tr:hidden").show();
      $.each(s, function(){
           $("#posts tr:visible .indexColumn:not(:contains('"
              + this + "'))").parent().hide();
        });
      });
    });
    </script>

    <?php 
    }
}
Exemplo n.º 4
0
function bm_sitemap_include()
{
    global $BMPAGEURL, $page, $xml;
    if (strval($page['url']) == $BMPAGEURL) {
        $books = bm_get_books();
        foreach ($books as $book) {
            $url = bm_get_url('book') . $book->slug;
            $file = BMBOOKPATH . "{$book->slug}.xml";
            $date = makeIso8601TimeStamp(date("Y-m-d H:i:s", filemtime($file)));
            $item = $xml->addChild('url');
            $item->addChild('loc', $url);
            $item->addChild('lastmod', $date);
            $item->addChild('changefreq', 'monthly');
            $item->addChild('priority', '0.5');
        }
    }
}