function page_rows($parent = 0, $level = 0, $pages = 0)
{
    global $wpdb, $class, $user_level, $post;
    if (!$pages) {
        $pages = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_status = 'static' ORDER BY menu_order");
    }
    if ($pages) {
        foreach ($pages as $post) {
            start_wp();
            if ($post->post_parent == $parent) {
                $post->post_title = wp_specialchars($post->post_title);
                $pad = str_repeat('— ', $level);
                $id = $post->ID;
                $class = 'alternate' == $class ? '' : 'alternate';
                ?>
<tr class='<?php 
                echo $class;
                ?>
'>
	<th scope="row"><?php 
                echo $post->ID;
                ?>
</th>
	<td>
	<?php 
                echo $pad;
                the_title();
                ?>
	</td>
	<td><?php 
                the_author();
                ?>
</td>
	<td><?php 
                echo mysql2date('Y-m-d g:i a', $post->post_modified);
                ?>
</td>
	<td><a href="<?php 
                the_permalink();
                ?>
" rel="permalink" class="edit"><?php 
                _e('View');
                ?>
</a></td>
	<td><?php 
                if ($user_level > $authordata->user_level or $user_login == $authordata->user_login) {
                    echo "<a href='post.php?action=edit&amp;post={$id}' class='edit'>" . __('Edit') . "</a>";
                }
                ?>
</td>
	<td><?php 
                if ($user_level > $authordata->user_level or $user_login == $authordata->user_login) {
                    echo "<a href='post.php?action=delete&amp;post={$id}' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \\'%s\\'\\n  \\'OK\\' to delete, \\'Cancel\\' to stop."), the_title('', '', 0)) . "')\">" . __('Delete') . "</a>";
                }
                ?>
</td>
</tr>

<?php 
                page_rows($id, $level + 1, $pages);
            }
        }
    } else {
        return false;
    }
}
    print_column_headers('edit-pages');
    ?>
  </tr>
  </thead>

  <tfoot>
  <tr>
<?php 
    print_column_headers('edit-pages', false);
    ?>
  </tr>
  </tfoot>

  <tbody>
  <?php 
    page_rows($posts, $pagenum, $per_page);
    ?>
  </tbody>
</table>

<div class="tablenav">
<?php 
    if ($page_links) {
        echo "<div class='tablenav-pages'>{$page_links_text}</div>";
    }
    ?>

<div class="alignleft actions">
<select name="action2">
<option value="-1" selected="selected"><?php 
    _e('Bulk Actions');
            if (current_user_can('edit_pages')) {
                echo "<a href='post.php?action=edit&amp;post={$post->ID}' class='edit'>" . __('Edit') . "</a>";
            }
            ?>
</td> 
    <td><?php 
            if (current_user_can('edit_pages')) {
                echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post={$post->ID}", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title('', '', 0))) . "' );\">" . __('Delete') . "</a>";
            }
            ?>
</td> 
  </tr>
<?php 
        }
    } else {
        page_rows();
    }
    ?>
</table> 

<div id="ajax-response"></div>

<?php 
} else {
    ?>
<p><?php 
    _e('No pages yet.');
    ?>
</p>
<?php 
}
Exemplo n.º 4
0
function page_rows($parent = 0, $level = 0, $pages = 0, $hierarchy = true)
{
    global $wpdb, $class, $post;
    if (!$pages) {
        $pages = get_pages('sort_column=menu_order');
    }
    if (!$pages) {
        return false;
    }
    foreach ($pages as $post) {
        setup_postdata($post);
        if ($hierarchy && $post->post_parent != $parent) {
            continue;
        }
        $post->post_title = wp_specialchars($post->post_title);
        $pad = str_repeat('&#8212; ', $level);
        $id = (int) $post->ID;
        $class = 'alternate' == $class ? '' : 'alternate';
        ?>
  <tr id='page-<?php 
        echo $id;
        ?>
' class='<?php 
        echo $class;
        ?>
'>
    <th scope="row" style="text-align: center"><?php 
        echo $post->ID;
        ?>
</th>
    <td>
      <?php 
        echo $pad;
        the_title();
        ?>
    </td>
    <td><?php 
        the_author();
        ?>
</td>
    <td><?php 
        if ('0000-00-00 00:00:00' == $post->post_modified) {
            _e('Unpublished');
        } else {
            echo mysql2date(__('Y-m-d g:i a'), $post->post_modified);
        }
        ?>
</td>
	<td><a href="<?php 
        the_permalink();
        ?>
" rel="permalink" class="view"><?php 
        _e('View');
        ?>
</a></td>
    <td><?php 
        if (current_user_can('edit_page', $id)) {
            echo "<a href='page.php?action=edit&amp;post={$id}' class='edit'>" . __('Edit') . "</a>";
        }
        ?>
</td>
    <td><?php 
        if (current_user_can('delete_page', $id)) {
            echo "<a href='" . wp_nonce_url("page.php?action=delete&amp;post={$id}", 'delete-page_' . $id) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . js_escape(sprintf(__("You are about to delete the '%s' page.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>";
        }
        ?>
</td>
  </tr>

<?php 
        if ($hierarchy) {
            page_rows($id, $level + 1, $pages);
        }
    }
}
function page_rows($parent = 0, $level = 0, $pages = 0)
{
    global $wpdb, $class, $post;
    if (!$pages) {
        $pages = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_status = 'static' ORDER BY menu_order");
    }
    if ($pages) {
        foreach ($pages as $post) {
            start_wp();
            if ($post->post_parent == $parent) {
                $post->post_title = wp_specialchars($post->post_title);
                $pad = str_repeat('&#8212; ', $level);
                $id = $post->ID;
                $class = 'alternate' == $class ? '' : 'alternate';
                ?>
  <tr id='page-<?php 
                echo $id;
                ?>
' class='<?php 
                echo $class;
                ?>
'> 
    <th scope="row"><?php 
                echo $post->ID;
                ?>
</th> 
    <td>
      <?php 
                echo $pad;
                the_title();
                ?>
 
    </td> 
    <td><?php 
                the_author();
                ?>
</td>
    <td><?php 
                echo mysql2date('Y-m-d g:i a', $post->post_modified);
                ?>
</td> 
	<td><a href="<?php 
                the_permalink();
                ?>
" rel="permalink" class="edit"><?php 
                _e('View');
                ?>
</a></td>
    <td><?php 
                if (current_user_can('edit_pages')) {
                    echo "<a href='post.php?action=edit&amp;post={$id}' class='edit'>" . __('Edit') . "</a>";
                }
                ?>
</td> 
    <td><?php 
                if (current_user_can('edit_pages')) {
                    echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post={$id}", 'delete-post_' . $id) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title())) . "' );\">" . __('Delete') . "</a>";
                }
                ?>
</td> 
  </tr> 

<?php 
                page_rows($id, $level + 1, $pages);
            }
        }
    } else {
        return false;
    }
}
Exemplo n.º 6
0
         $data['post_status'] = 'private';
     } else {
         $data['post_status'] = $data['_status'];
     }
     if (empty($data['comment_status'])) {
         $data['comment_status'] = 'closed';
     }
     if (empty($data['ping_status'])) {
         $data['ping_status'] = 'closed';
     }
     // update the post
     edit_post();
     $post = array();
     if ('page' == $_POST['post_type']) {
         $post[] = get_post($_POST['post_ID']);
         page_rows($post);
     } elseif ('post' == $_POST['post_type']) {
         $mode = $_POST['post_view'];
         $post[] = get_post($_POST['post_ID']);
         post_rows($post);
     }
     exit;
     break;
 case 'inline-save-tax':
     check_ajax_referer('taxinlineeditnonce', '_inline_edit');
     if (!current_user_can('manage_categories')) {
         die(__('Cheatin&#8217; uh?'));
     }
     if (!isset($_POST['tax_ID']) || !($id = (int) $_POST['tax_ID'])) {
         die(-1);
     }
Exemplo n.º 7
0
function vicuna_list_pages()
{
    global $wpdb, $class, $post;
    // Query pages.
    $pages = get_pages('');
    if (!empty($pages)) {
        echo "<table>\n";
        foreach ($pages as $post) {
            setup_postdata($post);
            if ('0000-00-00 00:00:00' == $post->post_modified) {
                continue;
            }
            if ($hierarchy && $post->post_parent != $parent) {
                continue;
            }
            $post->post_title = wp_specialchars($post->post_title);
            $pad = str_repeat('&#8212; ', $level);
            $id = (int) $post->ID;
            $class = 'alternate' == $class ? '' : 'alternate';
            ?>
		<tr id='page-<?php 
            echo $id;
            ?>
' class='<?php 
            echo $class;
            ?>
'>
			<th scope="row" style="text-align: center"><?php 
            echo $post->ID;
            ?>
</th>
			<td>
				<?php 
            echo $pad;
            the_title();
            ?>
			</td>
			<td><?php 
            the_author();
            ?>
</td>
			<td><?php 
            echo mysql2date(__('Y-m-d g:i a'), $post->post_modified);
            ?>
</td>
			<td><a href="<?php 
            the_permalink();
            ?>
" rel="permalink" class="view"><?php 
            _e('View');
            ?>
</a></td>
		</tr>
	<?php 
            if ($hierarchy) {
                page_rows($id, $level + 1, $pages);
            }
        }
        echo "</table>\n";
    }
    return $output;
}
  <tr>
<?php $posts_columns = wp_manage_pages_columns(); ?>
<?php foreach($posts_columns as $post_column_key => $column_display_name) {
	if ( 'cb' === $post_column_key )
		$class = ' class="check-column"';
	elseif ( 'comments' === $post_column_key )
		$class = ' class="num"';
	else
		$class = '';
?>
	<th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th>
<?php } ?>
  </tr>
  </thead>
  <tbody>
  <?php page_rows($posts); ?>
  </tbody>
</table>

</form>

<div id="ajax-response"></div>

<?php
} else {
?>
</form>
<p><?php _e('No pages found.') ?></p>
<?php
} // end if ($posts)
?>
    _e('Owner');
    ?>
</th>
	<th scope="col"><?php 
    _e('Updated');
    ?>
</th>
	<th scope="col" colspan="3" style="text-align: center"><?php 
    _e('Action');
    ?>
</th>
  </tr>
  </thead>
  <tbody id="the-list">
<?php 
    page_rows(0, 0, $posts, $all);
    ?>
  </tbody>
</table>

<div id="ajax-response"></div>

<?php 
} else {
    ?>
<p><?php 
    _e('No pages yet.');
    ?>
</p>
<?php 
}
        ?>
	<th scope="col"<?php 
        echo $class;
        ?>
><?php 
        echo $column_display_name;
        ?>
</th>
<?php 
    }
    ?>
  </tr>
  </thead>
  <tbody>
  <?php 
    page_rows($posts);
    ?>
  </tbody>
</table>

</form>

<div id="ajax-response"></div>

<?php 
} else {
    ?>
</form>
<p><?php 
    _e('No pages found.');
    ?>