/** * Enqueue scripts and styles. * * @since 1.0 */ function bigboom_enqueue_scripts() { /* Register and enqueue styles */ wp_register_style('bb-icons', THEME_URL . '/css/icons.min.css', array(), THEME_VERSION); wp_register_style('bootstrap', THEME_URL . '/css/bootstrap.min.css', array(), '3.3.2'); wp_register_style('google-fonts', '//fonts.googleapis.com/css?family=Montserrat:400,700|Raleway:300,500,600,700,400'); if (!wp_style_is('js_composer_front', 'enqueued') && wp_style_is('js_composer_front', 'registered')) { wp_enqueue_style('js_composer_front'); } wp_enqueue_style('bigboom', get_stylesheet_uri(), array('google-fonts', 'bootstrap', 'bb-icons'), THEME_VERSION); // Load custom color scheme file if (intval(bigboom_theme_option('custom_color_scheme')) && bigboom_theme_option('custom_color_1')) { $upload_dir = wp_upload_dir(); $dir = path_join($upload_dir['baseurl'], 'custom-css'); $file = $dir . '/color-scheme.css'; wp_enqueue_style('bigboom-color-scheme', $file, THEME_VERSION); } /** Register and enqueue scripts */ $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_register_script('jquery-tabs', THEME_URL . '/js/jquery.tabs.js', array('jquery'), '1.0.0', true); wp_register_script('bigboom-plugins', THEME_URL . "/js/plugins{$min}.js", array('jquery'), THEME_VERSION, true); wp_enqueue_script('bigboom', THEME_URL . "/js/scripts{$min}.js", array('bigboom-plugins'), THEME_VERSION, true); wp_localize_script('bigboom', 'bigboom', array('ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('_bigboom_nonce'), 'direction' => is_rtl() ? 'rtl' : '')); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }
public function absoluteLink() { if (!$this->link) { return null; } return path_join($this->author->absoluteLink(), $this->link); }
function protect_gallery($gallery, $force = false) { $retval = $this->object->is_gallery_protected($gallery); if ($force || !$retval) { $storage = C_Gallery_Storage::get_instance(); $gallery_path = $storage->get_gallery_abspath($gallery); if ($gallery_path != null && file_exists($gallery_path)) { $protector_files = $this->_get_protector_list(); foreach ($protector_files as $name => $protector) { $path = $protector['path']; $full_path = path_join($gallery_path, $path); $full = null; if (file_exists($full_path)) { $full = file_get_contents($full_path); $result = $this->_find_protector_content($full, $protector); if ($result != null) { $full = substr_replace($full, $protector['content'], $result['start'], $result['size']); } } else { $full = $protector['tag-start'] . $protector['content'] . $protector['tag-end']; } file_put_contents($full_path, $full); $retval = true; } } } return $retval; }
function ReallySimpleCaptcha() { /* Characters available in images */ $this->chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'; /* Length of a word in an image */ $this->char_length = 4; /* Array of fonts. Randomly picked up per character */ $this->fonts = array(dirname(__FILE__) . '/gentium/GenBkBasR.ttf', dirname(__FILE__) . '/gentium/GenBkBasI.ttf', dirname(__FILE__) . '/gentium/GenBkBasBI.ttf', dirname(__FILE__) . '/gentium/GenBkBasB.ttf'); /* Directory temporary keeping CAPTCHA images and corresponding text files */ $this->tmp_dir = path_join(dirname(__FILE__), 'tmp'); /* Array of CAPTCHA image size. Width and height */ $this->img_size = array(72, 24); /* Background color of CAPTCHA image. RGB color 0-255 */ $this->bg = array(255, 255, 255); /* Foreground (character) color of CAPTCHA image. RGB color 0-255 */ $this->fg = array(0, 0, 0); /* Coordinates for a text in an image. I don't know the meaning. Just adjust. */ $this->base = array(6, 18); /* Font size */ $this->font_size = 14; /* Width of a character */ $this->font_char_width = 15; /* Image type. 'png', 'gif' or 'jpeg' */ $this->img_type = 'png'; /* Mode of temporary image files */ $this->file_mode = 0444; /* Mode of temporary answer text files */ $this->answer_file_mode = 0440; }
/** * Retrieve resized image URL * * @param int $id Post ID or Attachment ID * @param int $width desired width of image (optional) * @param int $height desired height of image (optional) * @return string URL * @author Shane & Peter, Inc. (Peter Chester) */ function get_image_url($id, $width = false, $height = false) { /**/ // Get attachment and resize but return attachment path (needs to return url) $attachment = wp_get_attachment_metadata($id); $attachment_url = wp_get_attachment_url($id); if (isset($attachment_url)) { if ($width && $height) { $uploads = wp_upload_dir(); $imgpath = $uploads['basedir'] . '/' . $attachment['file']; error_log($imgpath); $image = image_resize($imgpath, $width, $height); if ($image && !is_wp_error($image)) { error_log(is_wp_error($image)); $image = path_join(dirname($attachment_url), basename($image)); } else { $image = $attachment_url; } } else { $image = $attachment_url; } if (isset($image)) { return $image; } } }
/** * Generate a child theme. * * @since 1.1.0 */ public function generate() { global $wp_filesystem; WP_Filesystem(); $parent = wp_get_theme($this->template); if (!$parent->exists()) { return new WP_Error('invalid_template', esc_html__('Invalid parent theme slug.', 'audiotheme-agent')); } $parts = explode('/', $parent->get_template()); $slug = sprintf('%s-child', reset($parts)); $directory = path_join($parent->get_theme_root(), $slug); if ($wp_filesystem->exists($directory)) { return new WP_Error('directory_exists', esc_html__('Child theme directory already exists.', 'audiotheme-agent')); } if (false === $wp_filesystem->mkdir($directory)) { return new WP_Error('fs_error', esc_html__('Could not create child theme directory.', 'audiotheme-agent')); } $source = audiotheme_agent()->get_path('data/child-theme/'); copy_dir($source, $directory); if ($parent->get_screenshot()) { $wp_filesystem->copy(path_join($parent->get_template_directory(), $parent->get_screenshot('relative')), path_join($directory, $parent->get_screenshot('relative'))); } $data = array('{{author}}' => wp_get_current_user()->display_name, '{{author_url}}' => wp_get_current_user()->user_url, '{{name}}' => $parent->get('Name'), '{{slug}}' => $parent->get_template(), '{{url}}' => esc_url(home_url())); $files = array('functions.php', 'style.css'); foreach ($files as $file) { $filename = path_join($directory, $file); $contents = $wp_filesystem->get_contents($filename); $contents = str_replace(array_keys($data), array_values($data), $contents); $wp_filesystem->put_contents($filename, $contents); } return true; }
/** * Migrate a single attachment's files to S3 * * @subcommand migrate-attachment * @synopsis <attachment-id> [--delete-local] */ public function migrate_attachment_to_s3($args, $args_assoc) { // Ensure things are active $instance = S3_Uploads::get_instance(); if (!s3_uploads_enabled()) { $instance->setup(); } $old_upload_dir = $instance->get_original_upload_dir(); $upload_dir = wp_upload_dir(); $files = array(get_post_meta($args[0], '_wp_attached_file', true)); $meta_data = wp_get_attachment_metadata($args[0]); if (!empty($meta_data['sizes'])) { foreach ($meta_data['sizes'] as $file) { $files[] = path_join(dirname($meta_data['file']), $file['file']); } } foreach ($files as $file) { if (file_exists($path = $old_upload_dir['basedir'] . '/' . $file)) { if (!copy($path, $upload_dir['basedir'] . '/' . $file)) { WP_CLI::line(sprintf('Failed to moved %s to S3', $file)); } else { if (!empty($args_assoc['delete-local'])) { unlink($path); } WP_CLI::success(sprintf('Moved file %s to S3', $file)); } } else { WP_CLI::line(sprintf('Already moved to %s S3', $file)); } } }
function _wpsc_maybe_update_user_log_file() { $hashes = array('3.8' => '1526bcf18869f9ea2f4061f528a1a21a', '3.8.4' => '1d17c7fb086e2afcf942ca497629b4c9', '3.8.8' => 'f9549ba1b1956c78f96b1551ab965c13', '3.8.9' => '4d0bcba88d211147399e79661cf3b41d', '3.8.10' => '09e2cb9c753587c9228a4e9e8008a82f'); if (function_exists('wpsc_flush_theme_transients')) { wpsc_flush_theme_transients(true); } // Using TEv2 if (!function_exists('wpsc_get_template_file_path')) { return; } //Make sure the theme has actually been moved. $file = wpsc_get_template_file_path('wpsc-user-log.php'); if (false !== strpos(WPSC_CORE_THEME_PATH, $file)) { return; } //If it has been moved, but it's the 3.8.10 version, we should be good to go. $hash = md5_file($file); if ($hashes['3.8.10'] === $hash) { return; } //At this point, we know the file has been moved to the active file folder. Checking now if it has been modified. if (in_array($hash, $hashes)) { //We now know that they've moved the file, but haven't actually changed anything. We can safely overwrite the file with the new core file. @copy($file, path_join(get_stylesheet_directory(), 'wpsc-user-log.php')); } else { //This means they have indeed changed the file. We need to add a notice letting them know about the issue and how to fix it. update_option('_wpsc_3811_user_log_notice', '1'); } }
public function __construct() { /* Mode of character set alphabet(en) or hiragana(jp) */ $this->lang_mode = 'jp'; /* Length of a word in an image */ $this->char_length = 4; /* Directory temporary keeping CAPTCHA images and corresponding text files */ $this->tmp_dir = path_join(dirname(__FILE__), 'tmp'); /* Array of CAPTCHA image size. Width and height */ $this->img_size = array(72, 24); /* Background color of CAPTCHA image. RGB color 0-255 */ $this->bg = array(255, 255, 255); /* Foreground (character) color of CAPTCHA image. RGB color 0-255 */ $this->fg = array(0, 0, 0); /* Coordinates for a text in an image. I don't know the meaning. Just adjust. */ $this->base = array(6, 18); /* Font size */ $this->font_size = 14; /* Width of a character */ $this->font_char_width = 15; /* Image type. 'png', 'gif' or 'jpeg' */ $this->img_type = 'png'; /* Mode of temporary image files */ $this->file_mode = 0444; /* Mode of temporary answer text files */ $this->answer_file_mode = 0440; }
/** * Generate custom color scheme css * * @since 1.0 */ function bigboom_generate_custom_color_scheme() { parse_str($_POST['data'], $data); if (!isset($data['custom_color_scheme'])) { return; } if (!$data['custom_color_scheme']) { return; } $color_1 = $data['custom_color_1']; if (!$color_1) { return; } // Prepare LESS to compile $less = file_get_contents(THEME_DIR . '/css/color-schemes/mixin.less'); $less .= ".custom-color-scheme { .color-scheme({$color_1}); }"; // Compile require THEME_DIR . '/inc/libs/lessc.inc.php'; $compiler = new lessc(); $compiler->setFormatter('compressed'); $css = $compiler->compile($less); // Get file path $upload_dir = wp_upload_dir(); $dir = path_join($upload_dir['basedir'], 'custom-css'); $file = $dir . '/color-scheme.css'; // Create directory if it doesn't exists wp_mkdir_p($dir); @file_put_contents($file, $css); wp_send_json_success(); }
function wpef7_upload_dir($type = false) { $siteurl = get_option('siteurl'); $upload_path = trim(get_option('upload_path')); if (empty($upload_path)) { $dir = WP_CONTENT_DIR . '/uploads'; } else { $dir = $upload_path; } $dir = path_join(ABSPATH, $dir); if (!($url = get_option('upload_url_path'))) { if (empty($upload_path) || $upload_path == $dir) { $url = WP_CONTENT_URL . '/uploads'; } else { $url = trailingslashit($siteurl) . $upload_path; } } if (defined('UPLOADS')) { $dir = ABSPATH . UPLOADS; $url = trailingslashit($siteurl) . UPLOADS; } if ('dir' == $type) { return $dir; } if ('url' == $type) { return $url; } return array('dir' => $dir, 'url' => $url); }
public function apply(Transformable $transformable) { $file = \File::get(public_path('assets/img/borders.png')); $img = base64_encode($file); $data = str_ireplace(["\r", "\n"], '', $transformable->getContents()); $data = preg_replace("~<(/?(br|p|dd))[^>]*?>~i", '<\\1>', $data); $data = preg_replace("~</(p|dd)>~i", '', $data); $data = preg_replace("~<(br|p|dd)>~i", static::LINEBREAK, $data); $data = preg_replace('/[ ]{2,}/', ' ', $data); $data = preg_replace("/" . static::LINEBREAK . "[ ]+/s", static::LINEBREAK . " ", $data); $data = str_replace(static::LINEBREAK, '<p>', $data); $page = $transformable->page; $author = $page->author; $charset = $transformable->charset ?: 'utf-8'; $title = $author->fio . " - " . $page->title; $link = \HTML::link(path_join("http://samlib.ru", $author->absoluteLink()), $author->fio) . " - " . \HTML::link(path_join("http://samlib.ru", $page->absoluteLink()), $page->title); $annotation = $page->annotation; $contents = $data; $downloaded = \Lang::get('pages.pages.downloaded', ['url' => \Request::fullUrl()]); if ($charset != 'utf-8') { $e = app('charset-encoder'); $c = $e->remap($charset, true); $title = $e->transform($title, 'utf-8', $c); $link = $e->transform($link, 'utf-8', $c); $annotation = $e->transform($annotation, 'utf-8', $c); $downloaded = $e->transform($downloaded, 'utf-8', $c); } $view = view('pages.html-download', compact('img', 'charset', 'title', 'link', 'annotation', 'contents', 'downloaded')); $transformable->setContents((string) $view); $transformable->setType(static::EXTENSION); return $transformable; }
function get_image_abspath($image, $size = FALSE, $check_existance = FALSE) { $retval = NULL; $dynthumbs = $this->object->get_registry()->get_utility('I_Dynamic_Thumbnails_Manager'); if ($dynthumbs && $dynthumbs->is_size_dynamic($size)) { // If we have the id, get the actual image entity if (is_numeric($image)) { $image = $this->object->_image_mapper->find($image); } // Ensure we have the image entity - user could have passed in an // incorrect id if (is_object($image)) { if ($folder_path = $this->object->get_cache_abspath($image->galleryid)) { $params = $dynthumbs->get_params_from_name($size, true); $image_filename = $dynthumbs->get_image_name($image, $params); $image_path = path_join($folder_path, $image_filename); if ($check_existance) { if (@file_exists($image_path)) { $retval = $image_path; } } else { $retval = $image_path; } } } } else { $retval = $this->call_parent('get_image_abspath', $image, $size, $check_existance); } return $retval; }
public static function display_about_page() { $about_page_file = apply_filters('easyazon_about_page_file', path_join(dirname(__FILE__), 'views/about.php')); if (file_exists($about_page_file)) { include $about_page_file; } }
function mtf_scripts() { wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', false, ''); wp_enqueue_script('jquery'); wp_enqueue_script("mtf_minitwitter", path_join(WP_PLUGIN_URL, basename(dirname(__FILE__)) . "/jquery.minitwitter.js"), array('jquery')); wp_enqueue_style("mtf_css", path_join(WP_PLUGIN_URL, basename(dirname(__FILE__)) . "/jquery.minitwitter.css")); }
/** * {@inheritdoc} * @param array $args * * uploads_dir - path to exported uploads dir (not the actual WP uploads dir! that remains untouched) */ public function execute(array $args, array $state = array()) { $backups = fw_ext('backups'); if (empty($args['uploads_dir'])) { return new WP_Error('no_uploads_dir', __('Uploads dir not specified', 'fw')); } else { $args['uploads_dir'] = fw_fix_path($args['uploads_dir']); if (!file_exists($args['uploads_dir'])) { /** * The uploads directory was not exported, nothing to do. */ return true; } } if (empty($state)) { $state = array('attachment_id' => 0); } /** * @var WPDB $wpdb */ global $wpdb; $sql = implode(array("SELECT * FROM {$wpdb->posts}", "WHERE post_type = 'attachment' AND post_mime_type LIKE %s AND ID > %d", "ORDER BY ID", "LIMIT 7"), " \n"); $wp_uploads_dir = wp_upload_dir(); $wp_uploads_dir_length = mb_strlen($wp_uploads_dir['basedir']); $started_time = time(); $timeout = $backups->get_timeout() - 7; while (time() - $started_time < $timeout) { $attachments = $wpdb->get_results($wpdb->prepare($sql, $wpdb->esc_like('image/') . '%', $state['attachment_id']), ARRAY_A); if (empty($attachments)) { return true; } foreach ($attachments as $attachment) { if (($meta = wp_get_attachment_metadata($attachment['ID'])) && isset($meta['sizes']) && is_array($meta['sizes'])) { $attachment_path = get_attached_file($attachment['ID']); $filename_length = mb_strlen(basename($attachment_path)); foreach ($meta['sizes'] as $size => $sizeinfo) { // replace wp_uploads_dir path $file_path = $args['uploads_dir'] . mb_substr($attachment_path, $wp_uploads_dir_length); // replace file name with resize name $file_path = mb_substr($file_path, 0, -$filename_length) . $sizeinfo['file']; if (file_exists($file_path)) { @unlink($file_path); } } } if (is_array($backup_sizes = get_post_meta($attachment['ID'], '_wp_attachment_backup_sizes', true))) { foreach ($backup_sizes as $size) { $del_file = path_join(dirname($meta['file']), $size['file']); @unlink(path_join($args['uploads_dir'], $del_file)); } } } $state['attachment_id'] = $attachment['ID']; } return $state; }
function render() { $view = path_join(NGGALLERY_ABSPATH, implode(DIRECTORY_SEPARATOR, array('admin', 'roles.php'))); include_once $view; ob_start(); nggallery_admin_roles(); $retval = ob_get_contents(); ob_end_clean(); return $retval; }
function wpcf7_plugin_url($path = '') { global $wp_version; if (version_compare($wp_version, '2.8', '<')) { // Using WordPress 2.7 $path = path_join(WPCF7_PLUGIN_NAME, $path); return plugins_url($path); } return plugins_url($path, WPCF7_PLUGIN_BASENAME); }
/** * Registers a single module * * @param string $slug The unique slug to use for the module * @param string $path The path to the module. Considered absolute if it starts with a / and relative to the plugin root if it does not * * @return bool|WP_Error True on success and WP_Error on failure */ public function register_module($slug, $path) { $slug = sanitize_title_with_dashes($slug); if ($path[0] != DIRECTORY_SEPARATOR) { global $itsec_globals; $path = path_join($itsec_globals['plugin_dir'], $path); } $this->_module_paths[$slug] = $path; return true; }
/** * Search the active theme for a template, falling back to the plugin template. * * Templates are are sought first in a 'prompt' subdirectory, then the theme * root. If none are found, the plugin default is used. * * @return string Selected template. */ public function locate() { // First choice is a template in the theme root or prompt subdirectory $template_names = array('postmatic/' . $this->name, 'prompt/' . $this->name, $this->name); $template = locate_template($template_names); // Fallback is the core or provided directory if (!$template) { $template = path_join($this->dir, $this->name); } return $template; }
protected static function load_module($mod) { $dir = WPCF7_PLUGIN_MODULES_DIR; if (empty($dir) || !is_dir($dir)) { return false; } $file = path_join($dir, $mod . '.php'); if (file_exists($file)) { include_once $file; } }
function hack_wp_generate_attachment_metadata($metadata, $attachment_id) { if (!isset($metadata['file'])) { return $metadata; } $attachment = get_post($attachment_id); $uploadPath = wp_upload_dir(); $file = path_join($uploadPath['basedir'], $metadata['file']); $metadata = array(); if (preg_match('!^image/!', get_post_mime_type($attachment)) && file_is_displayable_image($file)) { $imagesize = getimagesize($file); $metadata['width'] = $imagesize[0]; $metadata['height'] = $imagesize[1]; list($uwidth, $uheight) = wp_constrain_dimensions($metadata['width'], $metadata['height'], 128, 96); $metadata['hwstring_small'] = "height='{$uheight}' width='{$uwidth}'"; // Make the file path relative to the upload dir $metadata['file'] = _wp_relative_upload_path($file); // make thumbnails and other intermediate sizes global $_wp_additional_image_sizes; foreach (get_intermediate_image_sizes() as $s) { $sizes[$s] = array('width' => '', 'height' => '', 'crop' => FALSE); if (isset($_wp_additional_image_sizes[$s]['width'])) { $sizes[$s]['width'] = intval($_wp_additional_image_sizes[$s]['width']); } else { $sizes[$s]['width'] = get_option("{$s}_size_w"); } // For default sizes set in options if (isset($_wp_additional_image_sizes[$s]['height'])) { $sizes[$s]['height'] = intval($_wp_additional_image_sizes[$s]['height']); } else { $sizes[$s]['height'] = get_option("{$s}_size_h"); } // For default sizes set in options if (isset($_wp_additional_image_sizes[$s]['crop'])) { $sizes[$s]['crop'] = intval($_wp_additional_image_sizes[$s]['crop']); } else { $sizes[$s]['crop'] = get_option("{$s}_crop"); } // For default sizes set in options } foreach ($sizes as $size => $size_data) { $resized = hack_image_make_intermediate_size($file, $size_data['width'], $size_data['height'], $size_data['crop'], $size); if ($resized) { $metadata['sizes'][$size] = $resized; } } // fetch additional metadata from exif/iptc $image_meta = wp_read_image_metadata($file); if ($image_meta) { $metadata['image_meta'] = $image_meta; } } return $metadata; }
function builder_extension_image_downsize($result, $id, $size) { global $_ithemes_temp_downsize_size; if (is_array($size)) { // Dont bother with non-named sizes. Let them proceed normally. We need to set something to block the blocker though. $_ithemes_temp_downsize_size = 'array_size'; return; } // Store current meta information and size data. global $_ithemes_temp_downsize_meta; $_ithemes_temp_downsize_size = $size; $_ithemes_temp_downsize_meta = wp_get_attachment_metadata($id); if (!is_array($_ithemes_temp_downsize_meta)) { return $result; } if (!is_array($size) && !empty($_ithemes_temp_downsize_meta['sizes'][$size])) { $data = $_ithemes_temp_downsize_meta['sizes'][$size]; // Some handling if the size defined for this size name has changed. global $_wp_additional_image_sizes; if (empty($_wp_additional_image_sizes[$size])) { // Not a custom size so return data as is. $img_url = wp_get_attachment_url($id); $img_url = path_join(dirname($img_url), $data['file']); return array($img_url, $data['width'], $data['height'], true); } else { // Custom size so only return if current image file dimensions match the defined ones. $img_url = wp_get_attachment_url($id); $img_url = path_join(dirname($img_url), $data['file']); return array($img_url, $data['width'], $data['height'], true); } } require_once ABSPATH . '/wp-admin/includes/image.php'; $uploads = wp_upload_dir(); if (!is_array($uploads) || false !== $uploads['error']) { return $result; } $file_path = "{$uploads['basedir']}/{$_ithemes_temp_downsize_meta['file']}"; // Image is resized within the function in the following line. $temp_meta_information = wp_generate_attachment_metadata($id, $file_path); // triggers filter_image_downsize_blockextra() function via filter within. generate images. returns new meta data for image (only includes the just-generated image size). $meta_information = $_ithemes_temp_downsize_meta; // Get the old original meta information. if (!empty($temp_meta_information['sizes'][$_ithemes_temp_downsize_size])) { // This named size returned size dimensions in the size array key so copy it. $meta_information['sizes'][$_ithemes_temp_downsize_size] = $temp_meta_information['sizes'][$_ithemes_temp_downsize_size]; // Merge old meta back in. wp_update_attachment_metadata($id, $meta_information); // Update image meta data. } unset($_ithemes_temp_downsize_size); // Cleanup. unset($_ithemes_temp_downsize_meta); return $result; }
/** * Gets all fonts installed for watermarking * @return array */ function _get_watermark_fonts() { $retval = array(); foreach (scandir(path_join(NGGALLERY_ABSPATH, 'fonts')) as $filename) { if (strpos($filename, '.') === 0) { continue; } else { $retval[] = $filename; } } return $retval; }
function define() { parent::define('photocrati-nextgen', 'Photocrati NextGEN', 'Photocrati NextGEN', '2.0.33', 'http://www.nextgen-gallery.com', 'Photocrati Media', 'http://www.photocrati.com'); $module_path = path_join(dirname(__FILE__), 'modules'); $this->get_registry()->set_product_module_path($this->module_id, $module_path); $this->get_registry()->add_module_path($module_path, TRUE, FALSE); foreach (self::$modules as $module_name) { $this->_get_registry()->load_module($module_name); } include_once 'class.nextgen_product_installer.php'; C_Photocrati_Installer::add_handler($this->module_id, 'C_NextGen_Product_Installer'); }
/** * Vypíše hlášu pro chybu v systémových SQL skriptech souboru kt_core.sql * NENÍ POTŘEBA VOLAT VEŘEJNĚ * * @author Martin Hlaváč * @link http://www.ktstudio.cz */ function kt_sql_script_admin_notice() { $fileName = path_join(KT_CORE_PATH, "kt_core.sql"); ?> <div class="notice notice-warning is-dismissible"> <p><?php _e("POZOR: SQL skripty ze souboru \"{$fileName}\" se základními tabulkami WP Frameworku nebyly (plně) automaticky provedeny...", KT_DOMAIN); ?> </p> </div> <?php }
/** * Concrete implementation of the validate() method. This methods determines * whether input validation passes or not. * @param object ReusableOption &$target The option to validate. * @return String The error message created by this test. * @access public */ function validate(&$target) { $filename = $this->_file ? $this->_file : $target->getValue(); $filename = path_join(ABSPATH, $filename); //$filename = ABSPATH . $filename; if (!is_writable($filename)) { $errMsg = "The file " . $filename . " is not writable, check permissions."; $this->raiseErrorMessage($errMsg); return false; } return true; }
public function bootstrap(Application $app) { $this->app = $app; $this->fs = new Filesystem(); $paths = [$app->exportPath(), $app->homePath(), $app->storagePath(), $app->databasePath(), $app->publicPath(), $app->configPath()]; foreach ($paths as $path) { $this->ensureDirectory($path); } $storagePaths = ['app', 'framework', 'framework/cache', 'framework/views', 'framework/sessions', 'logs', $app->getSlug()]; foreach ($storagePaths as $path) { $this->ensureDirectory(path_join($app->storagePath(), $path)); } }
function define() { parent::define('ds-royalslider', 'RoyalSlider for NextGEN', 'RoyalSlider for NextGEN', '1.0', 'http://dimsemenov.com/plugins/royal-slider/wordpress/', 'Dmitry Semenov', 'http://dimsemenov.com'); $module_path = path_join(dirname(__FILE__), 'modules'); $registry = $this->get_registry(); $registry->set_product_module_path($this->module_id, $module_path); $registry->add_module_path($module_path, TRUE, FALSE); foreach (self::$modules as $module_name) { $registry->load_module($module_name); } include_once 'class.ds_royalslider_installer.php'; C_Photocrati_Installer::add_handler($this->module_id, 'C_Ds_RoyalSlider_Installer'); }
function wpts_url($path = '') { global $wp_version; if (version_compare($wp_version, '2.8', '<')) { // Using WordPress 2.7 $folder = dirname(plugin_basename(__FILE__)); if ('.' != $folder) { $path = path_join(ltrim($folder, '/'), $path); } return plugins_url($path); } return plugins_url($path, __FILE__); }