Skip to content

Commit

Permalink
Updated to version 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sheabunge committed Jun 17, 2013
1 parent b8eaf34 commit 36c0e2f
Show file tree
Hide file tree
Showing 143 changed files with 10,404 additions and 615 deletions.
359 changes: 149 additions & 210 deletions code-snippets.php

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#icon-snippets.icon32{
background: url('../img/icon32.png') no-repeat scroll transparent;
#icon-snippets.icon32 {
background: url('../images/icon32.png') no-repeat scroll transparent;
}

/* Snippets > Manage Snippets */

.inactive a:hover{
.inactive a:hover {
color: #d54e21;
}

Expand All @@ -13,17 +13,17 @@ a.delete:hover {
border-bottom-color: #f00;
}

a.delete{
a.delete {
color: #21759b;
}

tr{
tr {
background-color: #fcfcfc;
}

.inactive,
.inactive th,
.inactive td{
.inactive td {
background-color: #f4f4f4;
}

Expand Down
File renamed without changes
File renamed without changes
Binary file removed img/icon-big.png
Binary file not shown.
Binary file removed img/icon-horiz.png
Binary file not shown.
Binary file removed img/icon-med.png
Binary file not shown.
Binary file removed img/icon-small.png
Binary file not shown.
Binary file removed img/icon.odg
Binary file not shown.
58 changes: 0 additions & 58 deletions img/icon.svg

This file was deleted.

30 changes: 0 additions & 30 deletions inc/uninstall-plugin.php

This file was deleted.

32 changes: 16 additions & 16 deletions inc/edit-snippets.php → includes/admin-edit.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<?php
$edit = isset( $_GET['action'] ) && $_GET['action'] == 'edit';
if( $edit )
$id = intval( $_GET['id'] );
if( !class_exists( 'Code_Snippets' ) ) exit;
$edit = isset( $_GET['action'] ) && $_GET['action'] == 'edit';

if( $edit )
$id = intval( $_GET['id'] );
?>
<div class="wrap">
<div id="icon-snippets" class="icon32"><br /></div><h2><?php
if( $edit ) :
?>Edit Snippet<a href="<?php echo $this->edit_snippets_url; ?>" class="add-new-h2">Add New</a></h2><?php
?>Edit Snippet<a href="<?php echo $this->admin_edit_url; ?>" class="add-new-h2">Add New</a></h2><?php
else:
?>Add New Snippet</h2>
<?php endif; ?>
<?php if ( strlen( $msg ) ) : ?>
<?php if ( isset( $msg ) ) : ?>
<div id="message" class="updated fade"><p><?php echo $msg; ?></p></div>
<?php else: ?>
<br />
<?php endif; ?>
<form method="post" action="">
<?php if( $edit ) : ?>
<?php $record = $wpdb->get_row( "SELECT * FROM `$this->table_name` WHERE `id` = '$id';" ); ?>
<?php $record = $wpdb->get_row( "SELECT * FROM `$this->table` WHERE `id` = '$id';" ); ?>
<input type="hidden" name="edit_id" value="<?php echo $id;?>" />
<?php else: ?>
<?php
Expand All @@ -38,24 +40,22 @@

<label for="snippet_code"><h3 style="display:inline">Code</h3>
<span style="float:right">Enter or paste the snippet code without the <code>&lt;?php</code> and <code>?&gt;</code> tags.</span></label><br />
<textarea id="snippet_code" name="snippet_code" rows="20" spellcheck="false" style="font-family:monospace;width:100%"><?php echo htmlspecialchars_decode( stripslashes( $record->code ) );?></textarea>
<textarea id="snippet_code" name="snippet_code" rows="20" spellcheck="false" style="font-family:monospace;width:100%"><?php echo stripslashes( $record->code ); ?></textarea>
<br style="margin: 20px;" />
<div id="desclabel">
<label for="description" style="text-align:center; margin: 10px auto"><h3 style="display:inline">Description</h3> (Optional)</label><br />
</div>
<?php wp_editor( htmlspecialchars_decode( stripslashes( $record->description ) ), 'description', array( 'textarea_name' => 'snippet_description', 'textarea_rows' => 10 ) ); ?>
<?php wp_editor( htmlspecialchars_decode( stripslashes( $record->description ) ), 'description', array( 'textarea_name' => 'snippet_description', 'textarea_rows' => 10 ) ); ?>
<p class="submit">
<input tabindex="15" type="submit" name="save_snippet" class="button-primary" value="Save" />
<a href="<?php echo $this->manage_snippets_url; ?>" class="button">Cancel</a>
<a href="<?php echo $this->admin_manage_url; ?>" class="button">Cancel</a>
</p>
</form>
</div>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {

jQuery('textarea').tabby();

});
//]]>
editAreaLoader.init({
id : "snippet_code"
,syntax: "php"
,start_highlight: true
});
</script>
36 changes: 23 additions & 13 deletions inc/manage-snippets.php → includes/admin-manage.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php global $wpdb; ?>
<?php
if( !class_exists( 'Code_Snippets' ) ) exit;
global $wpdb;
?>
<div class="wrap">
<div id="icon-snippets" class="icon32"><br /></div><h2>Snippets <a href="<?php echo $this->edit_snippets_url; ?>" class="add-new-h2">Add New</a></h2>
<?php if ( strlen( $msg ) ) : ?>
<div id="icon-snippets" class="icon32"><br /></div><h2>Snippets <a href="<?php echo $this->admin_edit_url; ?>" class="add-new-h2">Add New</a></h2>
<?php if ( isset( $msg ) ) : ?>
<div id="message" class="updated fade"><p><?php echo $msg; ?></p></div>
<?php endif; ?>
<?php $snippets = $wpdb->get_results( 'select * from ' . $this->table_name ); ?>
<?php $snippets = $wpdb->get_results( 'select * from ' . $this->table ); ?>
<form action="" method="post">
<div class="tablenav top">
<div class="alignleft actions">
Expand All @@ -21,7 +24,7 @@
<thead>
<tr>
<th scope="col" class="check-column"><input type="checkbox" name="toggle" id="toggle" /></th>
<th scope="col" id="name">Name</th>
<th scope="col" id="name" style="min-width:180px">Name</th>
<th scope="col" id="description">Description</th>
</tr>
</thead>
Expand All @@ -33,16 +36,16 @@
else
echo 'active';
?>'>
<th scope="row" class="check-column"><input class="snippets" type="checkbox" name="snippets[]" value="<?php echo $snippet->id; ?>" /></th>
<td class="snippet-title"><strong><?php echo stripslashes($snippet->name);?></strong>
<th scope="row" class="check-column"><input class="snippets" type="checkbox" name="ids[]" value="<?php echo $snippet->id; ?>" /></th>
<td class="snippet-title"><strong><?php echo stripslashes( $snippet->name );?></strong>
<div class="row-actions-visible">
<?php if( $snippet->active == 0 ) : ?>
<span class='activate'><a href="<?php echo $this->manage_snippets_url . '&action=activate&id=' . $snippet->id; ?>" title="Activate this plugin" class="edit">Activate</a> | </span>
<span class='activate'><a href="<?php echo $this->admin_manage_url . '&action=activate&id=' . $snippet->id; ?>" title="Activate this snippet" class="edit">Activate</a> | </span>
<?php else : ?>
<span class='deactivate'><a href="<?php echo $this->manage_snippets_url . '&action=deactivate&id=' . $snippet->id; ?>" title="Deactivate this plugin" class="edit">Deactivate</a> | </span>
<span class='deactivate'><a href="<?php echo $this->admin_manage_url . '&action=deactivate&id=' . $snippet->id; ?>" title="Deactivate this snippet" class="edit">Deactivate</a> | </span>
<?php endif; ?>
<span class='edit'><a href="<?php echo $this->edit_snippets_url . '&action=edit&id=' . $snippet->id; ?>" title="Edit this Snippet" class="edit">Edit</a> | </span>
<span class='delete'><a href="<?php echo $this->manage_snippets_url . '&action=delete&id=' . $snippet->id; ?>" title="Delete this plugin" class="delete" onclick="return confirm('Are you sure? This action is non-reversable');">Delete</a></span>
<span class='edit'><a href="<?php echo $this->admin_edit_url . '&action=edit&id=' . $snippet->id; ?>" title="Edit this snippet" class="edit">Edit</a> | </span>
<span class='delete'><a href="<?php echo $this->admin_manage_url . '&action=delete&id=' . $snippet->id; ?>" title="Delete this snippet" class="delete" onclick="return confirm('Are you sure? This action is non-reversable');">Delete</a></span>
</div>
</td>
<td><?php echo stripslashes( html_entity_decode( $snippet->description ) ); ?></td>
Expand All @@ -51,16 +54,23 @@
<?php else: ?>
<tr id='no-groups'>
<th scope="row" class="check-column">&nbsp;</th>
<td colspan="4">You do not appear to have any snippets available at this time.</td>
<td colspan="4">You do not appear to have any snippets available at this time. <a href="<?php echo $this->admin_edit_url; ?>">Add New&rarr;</a></td>
</tr>
<?php endif;?>
<tfoot>
<tr>
<th scope="col" class="check-column"><input type="checkbox" name="toggle" id="toggle" /></th>
<th scope="col" id="name" style="min-width:160px">Name</th>
<th scope="col" id="description">Description</th>
</tr>
</tfoot>
</table>
<div class="tablenav bottom">
<div class="alignleft actions">
<select name='action2' class="bulk-actions">
<option value='-1' selected='selected'>Bulk Actions</option>
<option value='activate'>Activate</option>
<option value='deactivate'>Deactivate</option>
<option value='deactivate'>Dectivate</option>
<option value='delete'>Delete</option>
</select>
<input type="submit" id="doaction2" class="button-secondary action" value="Apply" />
Expand Down
Loading

0 comments on commit 36c0e2f

Please sign in to comment.