コード例 #1
0
function afg_view_delete_galleries()
{
    ?>
<div class='wrap'>
<h2><a href='http://www.ronakg.com/projects/awesome-flickr-gallery-wordpress-plugin/'><img src="<?php 
    echo BASE_URL . '/images/logo_big.png';
    ?>
" align='center'/></a>Saved Galleries | Awesome Flickr Gallery</h2>

<?php 
    if (isset($_POST['submit']) && $_POST['submit'] == 'Delete Selected Galleries') {
        $galleries = get_option('afg_galleries');
        foreach ($galleries as $id => $ginfo) {
            if ($id) {
                if (isset($_POST['delete_gallery_' . $id]) && $_POST['delete_gallery_' . $id] == 'on') {
                    unset($galleries[$id]);
                }
            }
        }
        update_option('afg_galleries', $galleries);
        ?>
    <div class="updated"><p><strong><?php 
        echo 'Galleries deleted successfully.';
        ?>
</strong></p></div> <?php 
    }
    echo afg_generate_version_line();
    $url = $_SERVER['REQUEST_URI'];
    ?>

      <form onsubmit="return verifySelectedGalleries()" method='post' action='<?php 
    echo $url;
    ?>
'>
         <div class="postbox-container" style="width:69%; margin-right:1%">
            <div id="poststuff">
               <div class="postbox" style='box-shadow:0 0 2px'>
                  <h3>Saved Galleries</h3>
                  <table class='form-table' style='margin-top:0'>
                     <tr style='border:1px solid Gainsboro' valign='top'>
                        <th cope='row'><input type='checkbox' name='delete_all_galleries' id='delete_all_galleries'
                           onclick="CheckAllDeleteGalleries()"/></th>
                        <th scope='row'><strong>ID</strong></th>
                        <th scope='row'><strong>Name</strong></th>
                        <th scope='row'><strong>Gallery Code</strong></th>
                        <th scope='row'><strong>Description</strong></th>
                     </tr>
<?php 
    $galleries = get_option('afg_galleries');
    foreach ($galleries as $id => $ginfo) {
        echo "<tr style='border:1px solid Gainsboro' valign='top'>";
        if ($id) {
            echo "<td style='width:4%'><input type='checkbox' name='delete_gallery_{$id}' id='delete_gallery_{$id}' /></td>";
        } else {
            echo "<td style='width:4%'></td>";
        }
        echo "<td style='width:12%'>{$id}</td>";
        if ($id) {
            echo "<th style='width:22%'>\r\n                <a href=\"{$_SERVER['PHP_SELF']}?page=afg_edit_galleries_page&gallery_id={$id}\" title='Edit this gallery'>\r\n        {$ginfo['name']}</a></th>";
            echo "<td style='width:22%; color:steelblue; font-size:110%;' onfocus='this.select()'>[AFG_gallery id='{$id}']</td>";
        } else {
            echo "<th style='width:22%'>{$ginfo['name']}</th>";
            echo "<td style='width:22%; color:steelblue; font-size:110%;' onfocus='this.select()'>[AFG_gallery]</td>";
        }
        echo "<td>{$ginfo['gallery_descr']}</td>";
        echo "</tr>";
    }
    ?>
                  </table>
            </div></div>
            <input type="submit" name="submit" class="button" value="Delete Selected Galleries" />
         </div>
         <div class="postbox-container" style="width: 29%;">
            <?php 
    echo afg_usage_box('the Gallery Code');
    echo afg_donate_box();
    echo afg_share_box();
    ?>
         </div>
      </form>
<?php 
}
コード例 #2
0
ファイル: afg_sports.php プロジェクト: parsonsc/dofe
function afg_view_edit_sports()
{
    ?>
<div class='wrap'>
<h2><img src="<?php 
    echo BASE_URL . '/images/logo_big.png';
    ?>
" align='center'/>Sports | Flickr Gallery</h2>

<?php 
    global $wpdb;
    $results = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}flickrsports");
    if (isset($_POST['submit']) && $_POST['submit'] == 'Submit') {
        foreach ($results as $row) {
            if (isset($_POST['delete_sport_' . $row->id]) && $_POST['delete_sport_' . $row->id] == 'on') {
                $wpdb->update($wpdb->prefix . "flickrsports", array('published' => $row->published == 1 ? 0 : 1), array('id' => $row->id), array('%d'), array('%d'));
            }
        }
        if (trim($_POST['sport_new']) != '') {
            $wpdb->insert($wpdb->prefix . "flickrsports", array('sport' => trim($_POST['sport_new']), 'published' => 1), array('%s', '%d'));
        }
    }
    ?>

<?php 
    echo afg_generate_version_line();
    $url = $_SERVER['REQUEST_URI'];
    ?>

      <form method='post' action='<?php 
    echo $url;
    ?>
'>
         <div class="postbox-container" style="width:69%; margin-right:1%">
            <div id="poststuff">
               <div class="postbox" style='box-shadow:0 0 2px'>
                  <h3>Sports</h3>
                  <table class='form-table' style='margin-top:0'>
                     <tr style='border:1px solid Gainsboro' valign='top'>
                        <th scope='row'></th>
                        <th scope='row'><strong>ID</strong></th>
                        <th scope='row'><strong>Sport</strong></th>
                        <th scope='row'><strong>Published</strong></th>
                     </tr>
                     
<?php 
    $results = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "flickrsports");
    foreach ($results as $row) {
        ?>
        <tr style='border:1px solid Gainsboro' valign='top'>
            <td style='width:4%'><input type='checkbox' name='delete_sport_<?php 
        echo $row->id;
        ?>
' id='delete_sport_<?php 
        echo $row->id;
        ?>
' /></td>
            <td style='width:12%'><?php 
        echo $row->id;
        ?>
</td>
            <th style='width:22%'><?php 
        echo $row->sport;
        ?>
</th>
            <td style='width:4%'><?php 
        echo $row->published == 1 ? 'X' : '';
        ?>
</td>
        </tr>    
<?php 
    }
    ?>
        <tr style='border:1px solid Gainsboro' valign='top'>
            <td style='width:4%'></td>
            <td style='width:12%'></td>
            <th style='width:22%'><input type="text" name="sport_new" /></th>
            <td style='width:4%'></td>
        </tr> 
                  </table>
            </div></div>
            <input type="submit" name="submit" class="button" value="Submit" />
         </div>
         <div class="postbox-container" style="width: 29%;">
            <?php 
    echo afg_usage_box('the Gallery Code');
    //echo afg_donate_box();
    //echo afg_share_box();
    ?>
         </div>
      </form>
<?php 
}
コード例 #3
0
function afg_view_delete_galleries()
{
    ?>
<div class='wrap'>
<h2><a href='http://www.ronakg.com/projects/awesome-flickr-gallery-wordpress-plugin/'><img src="<?php 
    echo BASE_URL . '/images/logo_big.png';
    ?>
" align='center'/></a>Saved Galleries | Awesome Flickr Gallery</h2>

<?php 
    if (isset($_POST['submit']) && $_POST['submit'] == 'Delete Selected Galleries') {
        $galleries = get_option('afg_galleries');
        foreach ($galleries as $id => $ginfo) {
            if ($id) {
                if (isset($_POST['delete_gallery_' . $id]) && $_POST['delete_gallery_' . $id] == 'on') {
                    unset($galleries[$id]);
                }
            }
        }
        update_option('afg_galleries', $galleries);
        ?>
    <div class="updated"><p><strong><?php 
        echo 'Galleries deleted successfully.';
        ?>
</strong></p></div> <?php 
    }
    echo afg_generate_version_line();
    $url = $_SERVER['REQUEST_URI'];
    ?>

      <form onsubmit="return verifySelectedGalleries()" method='post' action='<?php 
    echo $url;
    ?>
'>
         <div id="afg-wrap">
            <div id="afg-main-box">
                  <h3>Saved Galleries</h3>
                  <table class='wp-list-table widefat fixed pages afg-settings-box'>
                     <tr style="border:1px solid gray">
                        <th style='width:5%'><input type='checkbox' name='delete_all_galleries' id='delete_all_galleries'
                           onclick="CheckAllDeleteGalleries()"/></th>
                        <th style='width:12%'><strong>Gallery ID</strong></th>
                        <th style='width:20%'><strong>Gallery Name</strong></th>
                        <th style='width:20%'><strong>Gallery Code</strong></th>
                        <th style='width:43%'><strong>Description</strong></th>
                     </tr>
<?php 
    $row_count = 0;
    $galleries = get_option('afg_galleries');
    foreach ($galleries as $id => $ginfo) {
        if ($row_count % 2 == 0) {
            echo "<tr class='afg-saved-alternate'>";
        } else {
            echo "<tr>";
        }
        $row_count++;
        if ($id) {
            echo "<td><input type='checkbox' name='delete_gallery_{$id}' id='delete_gallery_{$id}' /></td>";
        } else {
            echo "<td></td>";
        }
        echo "<td>{$id}</td>";
        if ($id) {
            echo "<td>\n                <a href=\"{$_SERVER['PHP_SELF']}?page=afg_edit_galleries_page&gallery_id={$id}\" title='Edit this gallery'>\n        {$ginfo['name']}</a></td>";
            echo "<td style='color:steelblue;' onfocus='this.select()'>[AFG_gallery id='{$id}']</td>";
        } else {
            echo "<td>{$ginfo['name']}</td>";
            echo "<td style='color:steelblue;' onfocus='this.select()'>[AFG_gallery]</td>";
        }
        echo "<td>{$ginfo['gallery_descr']}</td>";
        echo "</tr>";
    }
    ?>
                  </table>
            <input style='margin-top:15px' type="submit" name="submit" class="button" value="Delete Selected Galleries" />
         </div>
             <div id="afg-side-box">
            <?php 
    echo afg_usage_box('the Gallery Code');
    echo afg_donate_box();
    echo afg_share_box();
    ?>
         </div>
             </div>
      </form>
<?php 
}