芝麻web文件管理V1.00
编辑当前文件:/www/wwwroot/shphe-en.com/wp-content/plugins/bb-plugin/classes/class-fl-builder-module.php
getFileName(); $dir_path = dirname($class_path); $this->name = $params['name']; $this->description = $params['description']; $this->category = $params['category']; $this->slug = basename($class_path, '.php'); $this->enabled = isset($params['enabled']) ? $params['enabled'] : true; $this->editor_export = isset($params['editor_export']) ? $params['editor_export'] : true; $this->partial_refresh = isset($params['partial_refresh']) ? $params['partial_refresh'] : false; // We need to normalize the paths here since path comparisons // break on Windows because they use backslashes. $abspath = str_replace( '\\', '/', ABSPATH ); $fl_builder_dir = str_replace( '\\', '/', FL_BUILDER_DIR ); $dir_path = str_replace( '\\', '/', $dir_path ); $stylesheet_directory = str_replace( '\\', '/', get_stylesheet_directory() ); $stylesheet_directory_uri = str_replace( '\\', '/', get_stylesheet_directory_uri() ); $template_directory = str_replace( '\\', '/', get_template_directory() ); $template_directory_uri = str_replace( '\\', '/', get_template_directory_uri() ); // Find the right paths. if(is_child_theme() && stristr($dir_path, $stylesheet_directory)) { $this->url = trailingslashit(str_replace($stylesheet_directory, $stylesheet_directory_uri, $dir_path)); $this->dir = trailingslashit($dir_path); } else if(stristr($dir_path, $template_directory)) { $this->url = trailingslashit(str_replace($template_directory, $template_directory_uri, $dir_path)); $this->dir = trailingslashit($dir_path); } else if(isset($params['url']) && isset($params['dir'])) { $this->url = trailingslashit($params['url']); $this->dir = trailingslashit($params['dir']); } else if(!stristr($dir_path, $fl_builder_dir)) { $this->url = trailingslashit(str_replace(trailingslashit($abspath), trailingslashit(home_url()), $dir_path)); $this->dir = trailingslashit($dir_path); } else { $this->url = trailingslashit(FL_BUILDER_URL . 'modules/' . $this->slug); $this->dir = trailingslashit(FL_BUILDER_DIR . 'modules/' . $this->slug); } } /** * Used to enqueue additional frontend styles. Do not enqueue * frontend.css or frontend.responsive.css as those will be * enqueued automatically. Params are the same as those used in * WordPress' wp_enqueue_style function. * * @since 1.0 * @param string $handle * @param string $src * @param array $deps * @param string $ver * @param string $media * @return void */ public function add_css($handle, $src = null, $deps = null, $ver = null, $media = null) { $this->css[$handle] = array($src, $deps, $ver, $media); } /** * Used to enqueue additional frontend scripts. Do not enqueue * frontend.js as that will be enqueued automatically. Params * are the same as those used in WordPress' wp_enqueue_script function. * * @since 1.0 * @param string $handle * @param string $src * @param array $deps * @param string $ver * @param bool $in_footer * @return void */ public function add_js($handle, $src = null, $deps = null, $ver = null, $in_footer = null) { $this->js[$handle] = array($src, $deps, $ver, $in_footer); } /** * Enqueues the needed styles for any icon fields * in this module. * * @since 1.4.6 * @return void */ public function enqueue_icon_styles() { FLBuilderIcons::enqueue_styles_for_module( $this ); } /** * Enqueues the needed styles for any font fields * in this module. * * @since 1.6.3 * @return void */ public function enqueue_font_styles() { FLBuilderFonts::add_fonts_for_module( $this ); } /** * Should be overridden by subclasses to enqueue * additional css/js using the add_css and add_js methods. * * @since 1.0 * @return void */ public function enqueue_scripts() { } /** * Should be overridden by subclasses to * work with settings data before it is saved. * * @since 1.0 * @param object A settings object that is going to be saved. * @return object */ public function update($settings) { return $settings; } /** * Should be overridden by subclasses to work with a module before * it is deleted. Please note, this method is called when a module * is updated and when it's actually removed from the page and should * be used for things like clearing photo cache from the builder's * cache directory. If only need to run logic when a module is * actually removed from the page, use the remove method instead. * * @since 1.0 * @return void */ public function delete() { } /** * Should be overridden by subclasses to work with a module when * it is actually removed from the page. * * @since 1.0 * @return void */ public function remove() { } }