Plugin Directory

Changeset 1062917


Ignore:
Timestamp:
01/08/2015 09:36:24 AM (11 years ago)
Author:
michaeltyson
Message:

Updated Roles and Capabilities from depreciated numerical to label capabilities; Added css/html to match WP 3.5+ layout (by OF-6)

Location:
custom-permalinks/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • custom-permalinks/trunk/custom-permalinks.php

    r1062911 r1062917  
    243243
    244244    // Re-run the filter, now with original environment in place
    245     remove_filter( 'request', 'custom_permalinks_request', 10, 1 );
     245    remove_filter( 'request', 'custom_permalinks_request', 'edit_files', 1 );
    246246    global $wp;
    247247    $wp->parse_request();
    248248    $query = $wp->query_vars;
    249     add_filter( 'request', 'custom_permalinks_request', 10, 1 );
    250    
     249    add_filter( 'request', 'custom_permalinks_request', 'edit_files', 1 );
     250
    251251    // Restore values
    252252    $_SERVER['REQUEST_URI'] = $oldRequestUri; $_SERVER['QUERY_STRING'] = $oldQueryString;
     
    313313        }
    314314    }
    315  
    316   return '<strong>' . __('Permalink:') . "</strong>\n" . $content . 
    317        ( isset($view_post) ? "<span id='view-post-btn'><a href='$permalink' class='button' target='_blank'>$view_post</a></span>\n" : "" );
     315
     316  return '<strong>' . __('Permalink:') . "</strong>\n" . $content .
     317       ( isset($view_post) ? "<span id='view-post-btn'><a href='$permalink' class='button button-small' target='_blank'>$view_post</a></span>\n" : "" );
    318318}
    319319
     
    418418  <?php endif; ?>
    419419      <?php echo home_url() ?>/
    420       <input type="text" class="text" value="<?php echo htmlspecialchars($permalink ? urldecode($permalink) : urldecode($original)) ?>"
    421         style="width: 250px; <?php if ( !$permalink ) echo 'color: #ddd;' ?>"
    422         onfocus="if ( this.style.color = '#ddd' ) { this.style.color = '#000'; }"
    423         onblur="document.getElementById('custom_permalink').value = this.value; if ( this.value == '' || this.value == '<?php echo htmlspecialchars(urldecode($original)) ?>' ) { this.value = '<?php echo htmlspecialchars(urldecode($original)) ?>'; this.style.color = '#ddd'; }"/>
    424   <?php if ( $renderContainers ) : ?>       
     420      <span id="editable-post-name" title="Click to edit this part of the permalink">
     421        <input type="text" id="new-post-slug" class="text" value="<?php echo htmlspecialchars($permalink ? urldecode($permalink) : urldecode($original)) ?>"
     422          style="width: 250px; <?php if ( !$permalink ) echo 'color: #ddd;' ?>"
     423          onfocus="if ( this.style.color = '#ddd' ) { this.style.color = '#000'; }"
     424          onblur="document.getElementById('custom_permalink').value = this.value; if ( this.value == '' || this.value == '<?php echo htmlspecialchars(urldecode($original)) ?>' ) { this.value = '<?php echo htmlspecialchars(urldecode($original)) ?>'; this.style.color = '#ddd'; }"/>
     425      </span>
     426  <?php if ( $renderContainers ) : ?>
    425427      <br />
    426428      <small><?php _e('Leave blank to disable', 'custom-permalink') ?></small>
     
    671673 */
    672674function custom_permalinks_original_post_link($post_id) {
    673   remove_filter( 'post_link', 'custom_permalinks_post_link', 10, 2 ); // original hook
    674   remove_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );
     675  remove_filter( 'post_link', 'custom_permalinks_post_link', 'edit_files', 2 ); // original hook
     676  remove_filter( 'post_type_link', 'custom_permalinks_post_link', 'edit_files', 2 );
    675677  $originalPermalink = ltrim(str_replace(home_url(), '', get_permalink( $post_id )), '/');
    676   add_filter( 'post_link', 'custom_permalinks_post_link', 10, 2 ); // original hook
    677   add_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );
     678  add_filter( 'post_link', 'custom_permalinks_post_link', 'edit_files', 2 ); // original hook
     679  add_filter( 'post_type_link', 'custom_permalinks_post_link', 'edit_files', 2 );
    678680  return $originalPermalink;
    679681}
     
    686688 */
    687689function custom_permalinks_original_page_link($post_id) {
    688   remove_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );
    689   remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
     690  remove_filter( 'page_link', 'custom_permalinks_page_link', 'edit_files', 2 );
     691  remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 );
    690692  $originalPermalink = ltrim(str_replace(home_url(), '', get_permalink( $post_id )), '/');
    691   add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
    692   add_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );
     693  add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 );
     694  add_filter( 'page_link', 'custom_permalinks_page_link', 'edit_files', 2 );
    693695  return $originalPermalink;
    694696}
     
    702704 */
    703705function custom_permalinks_original_tag_link($tag_id) {
    704   remove_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );
    705   remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
     706  remove_filter( 'tag_link', 'custom_permalinks_term_link', 'edit_files', 2 );
     707  remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 );
    706708  $originalPermalink = ltrim(str_replace(home_url(), '', get_tag_link($tag_id)), '/');
    707   add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
    708   add_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );
     709  add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 );
     710  add_filter( 'tag_link', 'custom_permalinks_term_link', 'edit_files', 2 );
    709711  return $originalPermalink;
    710712}
     
    717719 */
    718720function custom_permalinks_original_category_link($category_id) {
    719   remove_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );
    720   remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
     721  remove_filter( 'category_link', 'custom_permalinks_term_link', 'edit_files', 2 );
     722  remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 );
    721723  $originalPermalink = ltrim(str_replace(home_url(), '', get_category_link($category_id)), '/');
    722   add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
    723   add_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );
     724  add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 );
     725  add_filter( 'category_link', 'custom_permalinks_term_link', 'edit_files', 2 );
    724726  return $originalPermalink;
    725727}
     
    768770if (function_exists("add_action") && function_exists("add_filter")) {
    769771  add_action( 'template_redirect', 'custom_permalinks_redirect', 5 );
    770   add_filter( 'post_link', 'custom_permalinks_post_link', 10, 2 );
    771   add_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );
    772   add_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );
    773   add_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );
    774   add_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );
    775   add_filter( 'request', 'custom_permalinks_request', 10, 1 );
    776   add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
     772  add_filter( 'post_link', 'custom_permalinks_post_link', 'edit_files', 2 );
     773  add_filter( 'post_type_link', 'custom_permalinks_post_link', 'edit_files', 2 );
     774  add_filter( 'page_link', 'custom_permalinks_page_link', 'edit_files', 2 );
     775  add_filter( 'tag_link', 'custom_permalinks_term_link', 'edit_files', 2 );
     776  add_filter( 'category_link', 'custom_permalinks_term_link', 'edit_files', 2 );
     777  add_filter( 'request', 'custom_permalinks_request', 'edit_files', 1 );
     778  add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 'edit_files', 2 );
    777779
    778780  if (function_exists("get_bloginfo")) {
     
    781783
    782784  if ( $v[0] >= 2 ) {
    783       add_filter( 'get_sample_permalink_html', 'custom_permalink_get_sample_permalink_html', 10, 4 );
     785      add_filter( 'get_sample_permalink_html', 'custom_permalink_get_sample_permalink_html', 'edit_files', 4 );
    784786  } else {
    785787      add_action( 'edit_form_advanced', 'custom_permalinks_post_options' );
     
    796798  add_action( 'create_post_tag', 'custom_permalinks_save_tag' );
    797799  add_action( 'create_category', 'custom_permalinks_save_category' );
    798   add_action( 'delete_post', 'custom_permalinks_delete_permalink', 10);
     800  add_action( 'delete_post', 'custom_permalinks_delete_permalink', 'edit_files');
    799801  add_action( 'delete_post_tag', 'custom_permalinks_delete_term' );
    800802  add_action( 'delete_post_category', 'custom_permalinks_delete_term' );
  • custom-permalinks/trunk/readme.txt

    r1062908 r1062917  
    44Tags: permalink, url, link, address, custom, redirect
    55Requires at least: 2.6
    6 Tested up to: 3.9
     6Tested up to: 4.1
    77Stable tag: 0.7.20
    88
     
    3434  * Addressed a noisy warning
    3535  * Revised addition of admin forms js (don't use is_admin())
     36  * Updated Roles and Capabilities from depreciated numerical to label capabilities (by OF-6)
     37  * Added css/html to match WP 3.5+ layout (by OF-6)
    3638
    3739= 0.7.19 =
Note: See TracChangeset for help on using the changeset viewer.