| @@ -17,13 +17,10 @@ | ||
| 17 | 17 | case 'edit': |
| 18 | 18 | case 'save': |
| 19 | 19 | sh_cd_pages_your_shortcodes_edit( $action ); |
| 20 | 20 | break; |
| 21 | - case 'delete': | |
| 22 | - sh_cd_pages_your_shortcodes_list( $action ); | |
| 23 | - break; | |
| 24 | 21 | default: |
| 25 | - sh_cd_pages_your_shortcodes_list(); | |
| 22 | + sh_cd_pages_your_shortcodes_list( $action ); | |
| 26 | 23 | } |
| 27 | 24 | |
| 28 | 25 | } |
| 29 | 26 | |
| @@ -35,8 +32,15 @@ | ||
| 35 | 32 | if ( false === current_user_can( 'manage_options' ) ) { |
| 36 | 33 | wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); |
| 37 | 34 | } |
| 38 | 35 | |
| 36 | + // Cloning a shortcode? | |
| 37 | + if ( 'clone' === $action && false === empty( $_GET['id'] ) ) { | |
| 38 | + | |
| 39 | + sh_cd_clone( (int) $_GET['id'] ); | |
| 40 | + | |
| 41 | + } | |
| 42 | + | |
| 39 | 43 | // Deleting a shortcode? |
| 40 | 44 | if( 'delete' === $action && false === empty( $_GET['id'] ) ) { |
| 41 | 45 | |
| 42 | 46 | $result = sh_cd_db_shortcodes_delete( (int) $_GET['id'] ); |
| @@ -71,8 +75,9 @@ | ||
| 71 | 75 | <tr class="row-title"> |
| 72 | 76 | <th class="row-title" width="15%">Slug</th> |
| 73 | 77 | <th width="20%">Shortcode</th> |
| 74 | 78 | <th width="*">Shortcode content</th> |
| 79 | + <th width="60px" align="middle">Global</th> | |
| 75 | 80 | <th width="60px" align="middle">Enabled</th> |
| 76 | 81 | <th width="70px" align="middle">Options</th> |
| 77 | 82 | </tr> |
| 78 | 83 | <?php |
| @@ -98,10 +103,12 @@ | ||
| 98 | 103 | <td align="right"> |
| 99 | 104 | <textarea class="large-text inline-text-shortcode" id="sh-cd-text-area-%8$d" data-id="%8$d">%5$s</textarea> |
| 100 | 105 | <a class="button button-small sh-cd-inline-save-button" id="sh-cd-save-button-%8$d" data-id="%8$d"><i class="fas fa-save"></i> Save</a> |
| 101 | 106 | </td> |
| 107 | + <td align="middle"><a class="button button-small toggle-multisite" id="sc-cd-multisite-%8$s" data-id="%8$s"><i class="fas %10$s"></i></a></td> | |
| 102 | 108 | <td align="middle"><a class="button button-small toggle-disable" id="sc-cd-toggle-%8$s" data-id="%8$s"><i class="fas %6$s"></i></a></td> |
| 103 | - <td> | |
| 109 | + <td width="100"> | |
| 110 | + <a class="button button-small" href="%9$s"><i class="far fa-clone"></i></a> | |
| 104 | 111 | <a class="button button-small" href="%2$s"><i class="far fa-edit"></i></a> |
| 105 | 112 | <a class="button button-small" href="%7$s" onclick="return confirm(\'Are you sure you want to delete this shortcode?\');"><i class="fas fa-trash-alt"></i></a> |
| 106 | 113 | </td> |
| 107 | 114 | </tr>', |
| @@ -111,14 +118,16 @@ | ||
| 111 | 118 | SH_CD_SHORTCODE, |
| 112 | 119 | esc_html( stripslashes( $shortcode['data'] ) ), |
| 113 | 120 | ( 1 === (int) $shortcode['disabled'] ) ? 'fa-times' : 'fa-check', |
| 114 | 121 | $link . '&action=delete&id=' . $id, |
| 115 | - $id | |
| 122 | + $id, | |
| 123 | + ( true === sh_cd_license_is_premium() ) ? $link . '&action=clone&id=' . $id : sh_cd_license_upgrade_link(), | |
| 124 | + ( 1 === (int) $shortcode['multisite'] ) ? 'fa-check' : 'fa-times' | |
| 116 | 125 | ); |
| 117 | 126 | } |
| 118 | 127 | } |
| 119 | 128 | else { |
| 120 | - printf( '<tr><td colspan="4" align="center">You haven\'t created any shortcodes yet. <a href="%s">Add one now!</a></td></tr>', sh_cd_link_your_shortcodes_add() ); | |
| 129 | + printf( '<tr><td colspan="5" align="center">You haven\'t created any shortcodes yet. <a href="%s">Add one now!</a></td></tr>', sh_cd_link_your_shortcodes_add() ); | |
| 121 | 130 | } |
| 122 | 131 | ?> |
| 123 | 132 | </table> |
| 124 | 133 | <br clear="all" /> |