| @@ -13,8 +13,12 @@ | ||
| 13 | 13 | * The admin-specific functionality of the plugin. |
| 14 | 14 | * |
| 15 | 15 | * Defines the plugin name, version, and two examples hooks for how to |
| 16 | 16 | * enqueue the admin-specific stylesheet and JavaScript. |
| 17 | + * | |
| 18 | + * @package Smart_Post_Show | |
| 19 | + * @subpackage Smart_Post_Show/admin | |
| 20 | + * @author ShapedPlugin <support@shapedplugin.com> | |
| 17 | 21 | */ |
| 18 | 22 | class Smart_Post_Show_Admin { |
| 19 | 23 | |
| 20 | 24 | /** |
| @@ -40,25 +44,20 @@ | ||
| 40 | 44 | $this->version = $version; |
| 41 | 45 | |
| 42 | 46 | // Autoload system. |
| 43 | 47 | spl_autoload_register( array( $this, 'autoload' ) ); |
| 44 | - SPS_Metaboxes::preview_metabox( 'sp_pcp_display' ); | |
| 48 | + | |
| 45 | 49 | SPS_Metaboxes::layout_metabox( 'sp_pcp_layouts' ); |
| 46 | - | |
| 47 | 50 | SPS_Metaboxes::option_metabox( 'sp_pcp_view_options' ); |
| 48 | 51 | SPS_Metaboxes::shortcode_metabox( 'sp_pcp_display_shortcode' ); |
| 49 | 52 | SPS_Settings::settings( 'sp_post_carousel_settings' ); |
| 50 | - SPS_ReplaceLayout::Replace_Layout( 'sp_post_carousel_rpl' ); | |
| 51 | - SPS_Tools::tools( 'sp_post_carousel_tools' ); | |
| 52 | 53 | // Plugin action link Button. |
| 53 | 54 | add_filter( 'plugin_action_links', array( $this, 'add_plugin_action_links' ), 10, 2 ); |
| 54 | 55 | } |
| 55 | - | |
| 56 | 56 | /** |
| 57 | 57 | * Add plugin action menu |
| 58 | 58 | * |
| 59 | 59 | * @param array $links The action link. |
| 60 | - * @param array $file The file link. | |
| 61 | 60 | * |
| 62 | 61 | * @return array |
| 63 | 62 | */ |
| 64 | 63 | public function add_plugin_action_links( $links, $file ) { |
| @@ -63,16 +62,16 @@ | ||
| 63 | 62 | */ |
| 64 | 63 | public function add_plugin_action_links( $links, $file ) { |
| 65 | 64 | if ( SMART_POST_SHOW_BASENAME === $file ) { |
| 66 | 65 | $new_links = array( |
| 67 | - sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=sp_post_carousel' ), __( 'Manage Shows', 'post-carousel' ) ), | |
| 66 | + sprintf( '<a href="%s">%s</a>', admin_url( 'post-new.php?post_type=sp_post_carousel' ), __( 'Add New', 'smart-post-show' ) ), | |
| 67 | + sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=sp_post_carousel&page=pcp_settings' ), __( 'Settings', 'smart-post-show' ) ), | |
| 68 | 68 | ); |
| 69 | - $links['go_pro'] = sprintf( '<a href="%s" target="_blank" style="%s">%s</a>', 'https://smartpostshow.com/', 'color:#1dab87;font-weight:bold', __( 'Go Pro!', 'post-carousel' ) ); | |
| 69 | + $links['go_pro'] = sprintf( '<a href="%s" style="%s">%s</a>', 'https://smartpostshow.com/', 'color:#1dab87;font-weight:bold', __( 'Go Premium!', 'smart-post-show' ) ); | |
| 70 | 70 | return array_merge( $new_links, $links ); |
| 71 | 71 | } |
| 72 | 72 | return $links; |
| 73 | 73 | } |
| 74 | - | |
| 75 | 74 | /** |
| 76 | 75 | * Add plugin row meta link |
| 77 | 76 | * |
| 78 | 77 | * @param [array] $plugin_meta Add plugin row meta link. |
| @@ -80,11 +79,11 @@ | ||
| 80 | 79 | * @return array |
| 81 | 80 | */ |
| 82 | 81 | public function after_pcp_row_meta( $plugin_meta, $file ) { |
| 83 | 82 | if ( SMART_POST_SHOW_BASENAME == $file ) { |
| 84 | - $plugin_meta[] = '<a href="https://smartpostshow.com/demo/" target="_blank">' . __( 'Live Demo', 'post-carousel' ) . '</a>'; | |
| 85 | - $plugin_meta[] = '<a href="https://docs.shapedplugin.com/docs/post-carousel/overview/" target="_blank">' . __( 'Documentation', 'post-carousel' ) . '</a>'; | |
| 86 | - $plugin_meta[] = '<a href="https://shapedplugin.com/support/?user=lite" target="_blank">' . __( 'Support', 'post-carousel' ) . '</a>'; | |
| 83 | + $plugin_meta[] = '<a href="https://smartpostshow.com/demo/" target="_blank">' . __( 'Live Demo', 'smart-post-show' ) . '</a>'; | |
| 84 | + $plugin_meta[] = '<a href="https://docs.shapedplugin.com/docs/post-carousel/overview/" target="_blank">' . __( 'Documentation', 'smart-post-show' ) . '</a>'; | |
| 85 | + $plugin_meta[] = '<a href="https://shapedplugin.com/support/?user=lite" target="_blank">' . __( 'Support', 'smart-post-show' ) . '</a>'; | |
| 87 | 86 | } |
| 88 | 87 | return $plugin_meta; |
| 89 | 88 | } |
| 90 | 89 | /** |
| @@ -115,11 +114,9 @@ | ||
| 115 | 114 | public function enqueue_styles() { |
| 116 | 115 | $current_screen = get_current_screen(); |
| 117 | 116 | $the_current_post_type = $current_screen->post_type; |
| 118 | 117 | if ( 'sp_post_carousel' === $the_current_post_type ) { |
| 119 | - wp_enqueue_style( 'font-awesome' ); | |
| 120 | - wp_enqueue_style( 'pcp_swiper' ); | |
| 121 | - wp_enqueue_style( 'pcp-style' ); | |
| 118 | + wp_enqueue_style( 'pcp-font-awesome', SP_PC_URL . 'public/assets/css/font-awesome.min.css', array(), SP_PC_VERSION, 'all' ); | |
| 122 | 119 | } |
| 123 | 120 | wp_enqueue_style( 'sp-' . SP_PC_PLUGIN_NAME, SP_PC_URL . 'admin/assets/css/post-carousel-admin' . $this->suffix . '.css', array(), SP_PC_VERSION, 'all' ); |
| 124 | 121 | } |
| 125 | 122 | |
| @@ -144,10 +141,8 @@ | ||
| 144 | 141 | $current_screen = get_current_screen(); |
| 145 | 142 | $the_current_post_type = $current_screen->post_type; |
| 146 | 143 | if ( 'sp_post_carousel' === $the_current_post_type ) { |
| 147 | 144 | wp_enqueue_script( SP_PC_PLUGIN_NAME, SP_PC_URL . 'admin/assets/js/post-carousel-admin' . $this->suffix . '.js', array( 'jquery' ), SP_PC_VERSION, true ); |
| 148 | - wp_enqueue_script( 'pcp_swiper' ); | |
| 149 | - wp_enqueue_script( 'pcp_script' ); | |
| 150 | 145 | } |
| 151 | 146 | |
| 152 | 147 | } |
| 153 | 148 | |
| @@ -158,12 +153,12 @@ | ||
| 158 | 153 | * @return statement |
| 159 | 154 | */ |
| 160 | 155 | public function filter_carousel_admin_column() { |
| 161 | 156 | $admin_columns['cb'] = '<input type="checkbox" />'; |
| 162 | - $admin_columns['title'] = __( 'Title', 'post-carousel' ); | |
| 163 | - $admin_columns['shortcode'] = __( 'Shortcode', 'post-carousel' ); | |
| 164 | - $admin_columns['pcp_layout'] = __( 'Layout', 'post-carousel' ); | |
| 165 | - $admin_columns['date'] = __( 'Date', 'post-carousel' ); | |
| 157 | + $admin_columns['title'] = __( 'Title', 'smart-post-show' ); | |
| 158 | + $admin_columns['shortcode'] = __( 'Shortcode', 'smart-post-show' ); | |
| 159 | + $admin_columns['pcp_layout'] = __( 'Layout', 'smart-post-show' ); | |
| 160 | + $admin_columns['date'] = __( 'Date', 'smart-post-show' ); | |
| 166 | 161 | |
| 167 | 162 | return $admin_columns; |
| 168 | 163 | } |
| 169 | 164 | |
| @@ -178,15 +173,14 @@ | ||
| 178 | 173 | $pcp_layouts = get_post_meta( $post_id, 'sp_pcp_layouts', true ); |
| 179 | 174 | $carousels_types = isset( $pcp_layouts['pcp_layout_preset'] ) ? $pcp_layouts['pcp_layout_preset'] : ''; |
| 180 | 175 | switch ( $column ) { |
| 181 | 176 | case 'shortcode': |
| 182 | - ?> | |
| 183 | - <input class="sp_pcp_input" style="width: 230px;padding: 4px 8px;cursor: pointer;" type="text" onClick="this.select();" readonly="readonly" value="[smart_post_show id="<?php echo esc_attr( $post_id ); ?>"]"/> <div class="pcp-after-copy-text"><i class="fa fa-check-circle"></i> <?php esc_html_e( 'Shortcode Copied to Clipboard!', 'post-carousel' ); ?></div> | |
| 184 | - <?php | |
| 177 | + $column_field = '<input class="sp_pcp_input" style="width: 230px;padding: 4px 8px;cursor: pointer;" type="text" onClick="this.select();" readonly="readonly" value="[smart_post_show id="' . $post_id . '"]"/> <div class="pcp-after-copy-text"><i class="fa fa-check-circle"></i> Shortcode Copied to Clipboard! </div>'; | |
| 178 | + echo $column_field; | |
| 185 | 179 | break; |
| 186 | 180 | case 'pcp_layout': |
| 187 | 181 | $layout = ucwords( str_replace( '_layout', ' ', $carousels_types ) ); |
| 188 | - esc_html_e( $layout, 'post-carousel' ); | |
| 182 | + esc_html_e( $layout, 'smart-post-show' ); | |
| 189 | 183 | } // end switch. |
| 190 | 184 | } |
| 191 | 185 | |
| 192 | 186 | /** |
| @@ -195,10 +189,10 @@ | ||
| 195 | 189 | * @param array $messages alert messages. |
| 196 | 190 | */ |
| 197 | 191 | public function sppcp_update( $messages ) { |
| 198 | 192 | global $post, $post_ID; |
| 199 | - $messages['sp_post_carousel'][1] = __( 'Shortcode Updated', 'post-carousel' ); | |
| 200 | - $messages['sp_post_carousel'][6] = __( 'Shortcode Published', 'post-carousel' ); | |
| 193 | + $messages['sp_post_carousel'][1] = __( 'Shortcode Updated', 'smart-post-show' ); | |
| 194 | + $messages['sp_post_carousel'][6] = __( 'Shortcode Published', 'smart-post-show' ); | |
| 201 | 195 | return $messages; |
| 202 | 196 | } |
| 203 | 197 | |
| 204 | 198 | /** |
| @@ -203,14 +197,13 @@ | ||
| 203 | 197 | |
| 204 | 198 | /** |
| 205 | 199 | * Redirect after active |
| 206 | 200 | * |
| 207 | - * @param string $plugin The plugin help page. | |
| 201 | + * @param $plugin | |
| 208 | 202 | */ |
| 209 | - public function redirect_help_page( $plugin ) { | |
| 203 | + function redirect_help_page( $plugin ) { | |
| 210 | 204 | if ( SMART_POST_SHOW_BASENAME === $plugin ) { |
| 211 | - wp_safe_redirect( admin_url( 'edit.php?post_type=sp_post_carousel&page=pcp_help' ) ); | |
| 212 | - exit(); | |
| 205 | + exit( wp_redirect( admin_url( 'edit.php?post_type=sp_post_carousel&page=pcp_help' ) ) ); | |
| 213 | 206 | } |
| 214 | 207 | } |
| 215 | 208 | /** |
| 216 | 209 | * If it is the plugins page. |
| @@ -218,9 +211,9 @@ | ||
| 218 | 211 | * @since 2.2.0 |
| 219 | 212 | * @access private |
| 220 | 213 | */ |
| 221 | 214 | private function is_plugins_screen() { |
| 222 | - return in_array( get_current_screen()->id, array( 'plugins', 'plugins-network' ), true ); | |
| 215 | + return in_array( get_current_screen()->id, array( 'plugins', 'plugins-network' ) ); | |
| 223 | 216 | } |
| 224 | 217 | } |
| 225 | 218 | |
| 226 | 219 | /** |