芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/optimyar/wp-content/plugins/elementskit-lite/libs/pro-awareness/pro-awareness.php
script_version; } /** * Get current directory path * * @return string */ public function get_script_location() { return __FILE__; } public static function instance( $text_domain ) { self::$instance = new self(); return self::$instance->set_text_domain( $text_domain ); } protected function set_text_domain( $val ) { $this->text_domain = $val; return $this; } private function default_grid() { return array( 'url' => $this->default_grid_link, 'title' => $this->default_grid_title, 'thumbnail' => $this->default_grid_thumbnail, 'description' => $this->default_grid_desc, ); } public function set_parent_menu_text( $text ) { $this->parent_menu_text = $text; return $this; } public function set_default_grid_link( $url ) { $this->default_grid_link = $url; return $this; } public function set_default_grid_title( $title ) { $this->default_grid_title = $title; return $this; } public function set_default_grid_desc( $title ) { $this->default_grid_desc = $title; return $this; } public function set_default_grid_thumbnail( $thumbnail ) { $this->default_grid_thumbnail = $thumbnail; return $this; } public function set_parent_menu_slug( $slug ) { $this->parent_menu_slug = $slug; return $this; } public function set_menu_slug( $slug ) { $this->menu_slug = $slug; return $this; } public function set_plugin_file( $plugin_file ) { $this->plugin_file = $plugin_file; return $this; } public function set_pro_link( $url, $conf = array() ) { if ( $url == '' ) { return $this; } $this->pro_link_conf[] = array( 'url' => $url, 'target' => '_blank', 'anchor' => empty( $conf['anchor'] ) ? '
Upgrade To Premium
' : $conf['anchor'], 'permission' => empty( $conf['permission'] ) ? 'manage_options' : $conf['permission'], ); return $this; } /** * Set page grid */ public function set_page_grid( $conf = array() ) { if ( ! empty( $conf['url'] ) ) { $this->grids[] = array( 'url' => $conf['url'], 'title' => empty( $conf['title'] ) ? esc_html__( 'Default Title', 'elementskit-lite' ) : $conf['title'], 'thumbnail' => empty( $conf['thumbnail'] ) ? '' : esc_url( $conf['thumbnail'] ), 'description' => empty( $conf['description'] ) ? '' : $conf['description'], ); } return $this; } /** * Set wpmet products */ public function set_products( $product = array() ) { $this->products[] = array( 'url' => empty( $product['url'] ) ? '' : esc_url( $product['url'] ), 'title' => empty( $product['title'] ) ? esc_html__( 'Default Title', 'elementskit-lite' ) : $product['title'], 'thumbnail' => empty( $product['thumbnail'] ) ? '' : esc_url( $product['thumbnail'] ), 'description' => empty( $product['description'] ) ? '' : $product['description'], ); return $this; } /** * @deprecated This method will be removed */ public function set_grid( $conf = array() ) { $this->set_page_grid( $conf ); return $this; } protected function prepare_pro_links() { if ( ! empty( $this->pro_link_conf ) ) { foreach ( $this->pro_link_conf as $conf ) { add_submenu_page( $this->parent_menu_slug, $conf['anchor'], $conf['anchor'], $conf['permission'], $conf['url'], '' ); } } } protected function prepare_grid_links() { if ( ! empty( $this->grids ) ) { add_submenu_page( $this->parent_menu_slug, $this->parent_menu_text, $this->parent_menu_text, 'manage_options', $this->text_domain . $this->menu_slug, array( $this, 'generate_grids' ) ); } } public function generate_grids() { /** * Adding default grid at first position */ array_unshift( $this->grids, $this->default_grid() ); ?>
text_domain . '/pro_awareness/before_grid_contents' ); ?>
grids as $grid ) { ?>
products as $product ) : ?>
text_domain . '/pro_awareness/after_grid_contents' ); ?>
jQuery(document).ready( function($) { $('.pro_aware').parent().attr('target','_blank'); }); "; } public function insert_plugin_links( $links ) { foreach ( $this->action_links as $action_link ) { if ( ! empty( $action_link['link'] ) && ! empty( $action_link['text'] ) ) { $attributes = ''; if ( ! empty( $action_link['attr'] ) ) { foreach ( $action_link['attr'] as $key => $val ) { $attributes .= $key . '="' . esc_attr( $val ) . '" '; } } $links[] = sprintf( '
%s
', $action_link['link'], esc_html( $action_link['text'] ) ); } } return $links; } public function insert_plugin_row_meta( $links, $file ) { if ( $file == $this->plugin_file ) { foreach ( $this->row_meta_links as $meta ) { if ( ! empty( $meta['link'] ) && ! empty( $meta['text'] ) ) { $attributes = ''; if ( ! empty( $meta['attr'] ) ) { foreach ( $meta['attr'] as $key => $val ) { $attributes .= $key . '="' . esc_attr( $val ) . '" '; } } $links[] = sprintf( '
%s
', $meta['link'], $attributes, esc_html( $meta['text'] ) ); } } } return $links; } public function set_plugin_action_link( $text, $link, $attr = array() ) { $this->action_links[] = array( 'text' => $text, 'link' => $link, 'attr' => $attr, ); return $this; } public function set_plugin_row_meta( $text, $link, $attr = array() ) { $this->row_meta_links[] = array( 'text' => $text, 'link' => $link, 'attr' => $attr, ); return $this; } public function generate_menus() { add_filter( 'plugin_action_links_' . $this->plugin_file, array( $this, 'insert_plugin_links' ) ); add_filter( 'plugin_row_meta', array( $this, 'insert_plugin_row_meta' ), 10, 2 ); if ( ! empty( $this->parent_menu_slug ) ) { $this->prepare_grid_links(); $this->prepare_pro_links(); } } public static function init() { add_action( 'admin_head', array( __CLASS__, 'enqueue_scripts' ) ); } public function call() { add_action( 'admin_menu', array( $this, 'generate_menus' ), 99999 ); } } endif;