• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_mkdir_p函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_mkdir_p函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_mkdir_p函数的具体用法?PHP wp_mkdir_p怎么用?PHP wp_mkdir_p使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_mkdir_p函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: add_image

 static function add_image($image_url)
 {
     if (empty($image_url)) {
         return FALSE;
     }
     // Add Featured Image to Post
     $upload_dir = wp_upload_dir();
     // Set upload folder
     $image_data = file_get_contents($image_url);
     // Get image data
     $filename = basename($image_url);
     // Create image file name
     // Check folder permission and define file location
     if (wp_mkdir_p($upload_dir['path'])) {
         $file = $upload_dir['path'] . '/' . $filename;
     } else {
         $file = $upload_dir['basedir'] . '/' . $filename;
     }
     // Create the image  file on the server
     file_put_contents($file, $image_data);
     // Check image file type
     $wp_filetype = wp_check_filetype($filename, NULL);
     // Set attachment data
     $attachment = array('post_mime_type' => $wp_filetype['type'], 'post_title' => sanitize_file_name($filename), 'post_content' => '', 'post_status' => 'inherit');
     // Create the attachment
     $attach_id = wp_insert_attachment($attachment, $file);
     // Include image.php
     require_once ABSPATH . 'wp-admin/includes/image.php';
     // Define attachment metadata
     $attach_data = wp_generate_attachment_metadata($attach_id, $file);
     // Assign metadata to attachment
     wp_update_attachment_metadata($attach_id, $attach_data);
     return $attach_id;
 }
开发者ID:gpsidhuu,项目名称:alphaReputation,代码行数:34,代码来源:xsUTL.php


示例2: setUp

 /**
  * Setup the backup object and create the tmp directory
  *
  */
 public function setUp()
 {
     HM\BackUpWordPress\Path::get_instance()->set_path(dirname(__FILE__) . '/tmp');
     $this->backup = new HM\BackUpWordPress\Backup();
     $this->backup->set_root(dirname(__FILE__) . '/test-data/');
     wp_mkdir_p(hmbkp_path());
 }
开发者ID:rolka,项目名称:backupwordpress,代码行数:11,代码来源:testExcludesTest.php


示例3: folders

 public function folders()
 {
     global $mf_domain;
     $dir_list = "";
     $dir_list2 = "";
     wp_mkdir_p(MF_FILES_DIR);
     wp_mkdir_p(MF_CACHE_DIR);
     if (!is_dir(MF_CACHE_DIR)) {
         $dir_list2 .= "<li>" . MF_CACHE_DIR . "</li>";
     } elseif (!is_writable(MF_CACHE_DIR)) {
         $dir_list .= "<li>" . MF_CACHE_DIR . "</li>";
     }
     if (!is_dir(MF_FILES_DIR)) {
         $dir_list2 .= "<li>" . MF_FILES_DIR . "</li>";
     } elseif (!is_writable(MF_FILES_DIR)) {
         $dir_list .= "<li>" . MF_FILES_DIR . "</li>";
     }
     if ($dir_list2 != "") {
         echo "<div id='magic-fields-install-error-message' class='error'><p><strong>" . __('Magic Fields is not ready yet.', $mf_domain) . "</strong> " . __('must create the following folders (and must chmod 777):', $mf_domain) . "</p><ul>";
         echo $dir_list2;
         echo "</ul></div>";
     }
     if ($dir_list != "") {
         echo "<div id='magic-fields-install-error-message-2' class='error'><p><strong>" . __('Magic Fields is not ready yet.', $mf_domain) . "</strong> " . __('The following folders must be writable (usually chmod 777 is neccesary):', $mf_domain) . "</p><ul>";
         echo $dir_list;
         echo "</ul></div>";
     }
 }
开发者ID:mark2me,项目名称:pressform,代码行数:28,代码来源:mf_install.php


示例4: __construct

 /**
  * Sets defaults like cache, compile and template directory paths.
  *
  * @throws Exception When cache path cannot be used.
  */
 public function __construct()
 {
     $upload_dir = wp_upload_dir();
     $current_theme = wp_get_theme();
     $theme_slug = $current_theme->get_stylesheet();
     /**
      * Make the upload folder the root for changing files, this is the place
      * that is most likely writable.
      *
      * Keeping the theme name as container prevents accidental problems with
      * caching or compiling files when switching themes.
      */
     $root = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $theme_slug;
     $this->cache_path = implode(DIRECTORY_SEPARATOR, array($root, 'cache', ''));
     $this->compile_path = implode(DIRECTORY_SEPARATOR, array($root, 'compiled', ''));
     /**
      * Filter: views directory
      */
     $views_path = Stencil_Environment::filter('path-views', 'views');
     /**
      * Get all directories (root + optional child theme)
      */
     $this->template_path = Stencil_File_System::get_potential_directories($views_path);
     /**
      * Attempt to make the directories
      */
     if (!wp_mkdir_p($this->cache_path)) {
         throw new Exception('Cache path could not be created.');
     }
     if (!wp_mkdir_p($this->compile_path)) {
         throw new Exception('Compile path could not be created.');
     }
 }
开发者ID:moorscode,项目名称:stencil,代码行数:38,代码来源:implementation.php


示例5: update

 function update($file)
 {
     $response = array();
     $result = 0;
     // Create a temporary directory for all the files
     wp_mkdir_p($file . '.tmp');
     exec("{$this->command} export {$this->url} {$file}.tmp --force", $response, $result);
     if ($result === 0) {
         // Check if this is a plugin by scanning for a plugin header
         $files = glob($file . '.tmp/*.php');
         if (count($files) > 0) {
             foreach ($files as $tmp) {
                 $data = file_get_contents($tmp);
                 if (strpos($data, 'Plugin Name:') !== false) {
                     if (preg_match('/Version:\\s*(.*)/', $data, $matches) > 0) {
                         $this->version = trim($matches[1]);
                     }
                     break;
                 }
             }
             if (count($files) > 1) {
                 // Zip the directory
                 $zip = new zipfile();
                 $this->zip($zip, $file . '.tmp', $file . '.tmp');
                 $fd = fopen($file, 'w');
                 fwrite($fd, $zip->file());
                 fclose($fd);
             }
         }
         $this->cleanup($file . '.tmp');
     }
 }
开发者ID:slaFFik,项目名称:l10n-ru,代码行数:32,代码来源:svn.php


示例6: bigboom_generate_custom_color_scheme

/**
 * 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();
}
开发者ID:Qualitair,项目名称:ecommerce,代码行数:35,代码来源:meta-boxes.php


示例7: get_image_url

function get_image_url($path, $id, $width, $height)
{
    $image_path = $path;
    $upload_directory = wp_upload_dir();
    $modified_image_directory = $upload_directory["basedir"] . "/blog/" . $id . "/";
    if (!file_exists($modified_image_directory)) {
        wp_mkdir_p($modified_image_directory);
    }
    $file_name_with_ending = explode("/", $image_path);
    $file_name_with_ending = $file_name_with_ending[count($file_name_with_ending) - 1];
    $file_name_without_ending = explode(".", $file_name_with_ending);
    $file_ending = $file_name_without_ending[count($file_name_without_ending) - 1];
    $file_name_without_ending = $file_name_without_ending[count($file_name_without_ending) - 2];
    $modified_image_path = $modified_image_directory . md5($file_name_without_ending) . "." . $file_ending;
    if (!file_exists($modified_image_path)) {
        $image = wp_get_image_editor($image_path);
        if (!is_wp_error($image)) {
            $rotate = 180;
            $modified_file_name_without_ending = $file_name_without_ending . "-" . $width . "x" . $height . "-" . $rotate . "dg";
            $image->resize($width, $height);
            $image->rotate($rotate);
            $image->save($modified_file_name_without_ending);
        }
    }
    $modified_image_url = $upload_directory["url"] . "/" . $modified_file_name_without_ending . "." . $file_ending;
    return $modified_image_url;
}
开发者ID:TakenCdosG,项目名称:chefs,代码行数:27,代码来源:functions.php


示例8: install

 function install()
 {
     global $wpdb;
     $table_name = $wpdb->prefix . "egcl_certificates";
     //if($wpdb->get_var("show tables like '".$table_name."'") != $table_name)
     //{
     $upload_dir = wp_upload_dir();
     if (!file_exists($upload_dir["basedir"] . '/egiftcardlite')) {
         wp_mkdir_p($upload_dir["basedir"] . '/egiftcardlite');
     }
     $sourcelocation = plugin_dir_path(__FILE__) . 'defaultimages/';
     $targetlocation = $upload_dir["basedir"] . '/egiftcardlite/';
     copy($sourcelocation . 'smallimage_sample.png', $targetlocation . 'smallimage_sample.png');
     copy($sourcelocation . 'bigimage_sample.png', $targetlocation . 'bigimage_sample.png');
     copy($sourcelocation . 'certimage_sample.jpg', $targetlocation . 'certimage_sample.jpg');
     $sql = "CREATE TABLE " . $table_name . " (\r\n\t\t\t\tid int(11) NOT NULL auto_increment,\r\n\t\t\t\ttx_str varchar(31) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\tcode varchar(31) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\trecipient varchar(255) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\temail varchar(255) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\tprice float NOT NULL,\r\n\t\t\t\tcurrency varchar(15) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\tstatus int(11) NOT NULL,\r\n\t\t\t\tregistered int(11) NOT NULL,\r\n\t\t\t\tblocked int(11) NOT NULL,\r\n\t\t\t\tdeleted int(11) NULL,\r\n\t\t\t\tecard tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\tUNIQUE KEY  id (id)\r\n\t\t\t);";
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     dbDelta($sql);
     //}
     $table_name = $wpdb->prefix . "egcl_transactions";
     if ($wpdb->get_var("show tables like '" . $table_name . "'") != $table_name) {
         $sql = "CREATE TABLE " . $table_name . " (\r\n\t\t\t\tid int(11) NOT NULL auto_increment,\r\n\t\t\t\ttx_str varchar(31) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\tpayer_name varchar(255) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\tpayer_email varchar(255) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\tgross float NOT NULL,\r\n\t\t\t\tcurrency varchar(15) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\tpayment_status varchar(31) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\ttransaction_type varchar(31) collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\tdetails text collate utf8_unicode_ci NOT NULL,\r\n\t\t\t\tcreated int(11) NOT NULL,\r\n\t\t\t\tUNIQUE KEY  id (id)\r\n\t\t\t);";
         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
         dbDelta($sql);
     }
 }
开发者ID:nick-feifan,项目名称:healthwisetreat,代码行数:26,代码来源:egift-card-lite.php


示例9: save_woff_fonts_css

 public static function save_woff_fonts_css()
 {
     $fonts_dir = WP_CONTENT_DIR . '/uploads/fpd_fonts';
     //create fancy product orders directory
     if (!file_exists($fonts_dir)) {
         wp_mkdir_p($fonts_dir);
     }
     $fonts_css = WP_CONTENT_DIR . '/uploads/fpd_fonts/jquery.fancyProductDesigner-fonts.css';
     chmod($fonts_css, 0775);
     $handle = @fopen($fonts_css, 'w') or print 'Cannot open file:  ' . $fonts_css;
     $files = scandir($fonts_dir);
     $data = '';
     if (is_array($files)) {
         foreach ($files as $file) {
             if (preg_match("/.woff/", $file)) {
                 $new_file = str_replace(' ', '_', $file);
                 rename($fonts_dir . '/' . $file, $fonts_dir . '/' . $new_file);
                 $data .= '@font-face {' . "\n";
                 $data .= '  font-family: "' . preg_replace("/\\.[^.\\s]{3,4}\$/", "", str_replace('_', ' ', $file)) . '";' . "\n";
                 $data .= '  src: local("#"), url("' . content_url('/uploads/fpd_fonts/' . $new_file) . '") format("woff");' . "\n";
                 $data .= '  font-weight: normal;' . "\n";
                 $data .= '  font-style: normal;' . "\n";
                 $data .= '}' . "\n\n\n";
             }
         }
     }
     fwrite($handle, $data);
     fclose($handle);
 }
开发者ID:pcuervo,项目名称:ur-imprint,代码行数:29,代码来源:class-fonts-settings.php


示例10: do_install_woocommerce

/**
 * Install woocommerce
 */
function do_install_woocommerce()
{
    global $woocommerce_settings, $woocommerce;
    // Do install
    woocommerce_default_options();
    woocommerce_tables_install();
    woocommerce_install_custom_fields();
    // Register post types
    $woocommerce->init_taxonomy();
    // Add default taxonomies
    woocommerce_default_taxonomies();
    // Install folder for uploading files and prevent hotlinking
    $upload_dir = wp_upload_dir();
    $downloads_url = $upload_dir['basedir'] . '/woocommerce_uploads';
    if (wp_mkdir_p($downloads_url) && !file_exists($downloads_url . '/.htaccess')) {
        if ($file_handle = @fopen($downloads_url . '/.htaccess', 'w')) {
            fwrite($file_handle, 'deny from all');
            fclose($file_handle);
        }
    }
    // Install folder for logs
    $logs_url = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__))) . '/logs';
    if (wp_mkdir_p($logs_url) && !file_exists($logs_url . '/.htaccess')) {
        if ($file_handle = @fopen($logs_url . '/.htaccess', 'w')) {
            fwrite($file_handle, 'deny from all');
            fclose($file_handle);
        }
    }
    // Clear transient cache
    $woocommerce->clear_product_transients();
    // Update version
    update_option("woocommerce_db_version", $woocommerce->version);
}
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:36,代码来源:woocommerce-admin-install.php


示例11: install

 function install($last_modified)
 {
     global $wp_version;
     // Add / update the version number
     if (get_option('k2version') === false) {
         add_option('k2version', K2_CURRENT, 'This option stores K2\'s version number');
     } else {
         update_option('k2version', K2_CURRENT);
     }
     // Add / update the last modified timestamp
     if (get_option('k2lastmodified') === false) {
         add_option('k2lastmodified', $last_modified, 'This option stores K2\'s last application modification. Used for version checking');
     } else {
         update_option('k2lastmodified', $last_modified);
     }
     if (get_option('k2active') === false) {
         add_option('k2active', 0, 'This option stores if K2 has been activated');
     } else {
         update_option('k2active', 0);
     }
     // Create support folders for WordPressMU
     if (K2_MU) {
         if (!is_dir(ABSPATH . UPLOADS . 'k2support/')) {
             wp_mkdir_p(ABSPATH . UPLOADS . 'k2support/');
         }
         if (!is_dir(K2_STYLES_PATH)) {
             wp_mkdir_p(K2_STYLES_PATH);
         }
         if (!is_dir(K2_HEADERS_PATH)) {
             wp_mkdir_p(K2_HEADERS_PATH);
         }
     }
     // Call the install handlers
     do_action('k2_install');
 }
开发者ID:64kbytes,项目名称:stayinba,代码行数:35,代码来源:k2.php


示例12: edd_create_protection_files

/**
 * Creates blank index.php and .htaccess files
 *
 * This function runs approximately once per month in order
 * to ensure all folders have their necessary protection files
 *
 * @access      private
 * @since       1.1.5
 * @return      void
*/
function edd_create_protection_files()
{
    if (false === get_transient('edd_check_protection_files')) {
        $wp_upload_dir = wp_upload_dir();
        $upload_path = $wp_upload_dir['basedir'] . '/edd';
        wp_mkdir_p($upload_path);
        // top level blank index.php
        if (!file_exists($upload_path . '/index.php')) {
            @file_put_contents($upload_path . '/index.php', '<?php' . PHP_EOL . '// silence is golden');
        }
        // top level .htaccess file
        $rules = 'Options -Indexes';
        if (file_exists($upload_path . '/.htaccess')) {
            $contents = @file_get_contents($upload_path . '/.htaccess');
            if (false === strpos($contents, 'Options -Indexes') || !$contents) {
                @file_put_contents($upload_path . '/.htaccess', $rules);
            }
        }
        // now place index.php files in all sub folders
        $folders = edd_scan_folders($upload_path);
        foreach ($folders as $folder) {
            // create index.php, if it doesn't exist
            if (!file_exists($folder . 'index.php')) {
                @file_put_contents($folder . 'index.php', '<?php' . PHP_EOL . '// silence is golden');
            }
        }
        // only have this run the first time. This is just to create .htaccess files in existing folders
        set_transient('edd_check_protection_files', true, 2678400);
    }
}
开发者ID:ryannmicua,项目名称:Easy-Digital-Downloads,代码行数:40,代码来源:upload-functions.php


示例13: _handle_logo_upload

 function _handle_logo_upload()
 {
     if (!isset($_FILES['wdeb_logo'])) {
         return false;
     }
     $name = $_FILES['wdeb_logo']['name'];
     if (!$name) {
         return false;
     }
     $allowed = array('jpg', 'jpeg', 'png', 'gif');
     $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
     if (!in_array($ext, $allowed)) {
         wp_die(__('This file type is not supported', 'wdeb'));
     }
     $wp_upload_dir = wp_upload_dir();
     $logo_dir = $wp_upload_dir['basedir'] . '/wdeb';
     $logo_path = $wp_upload_dir['baseurl'] . '/wdeb';
     if (!file_exists($logo_dir)) {
         wp_mkdir_p($logo_dir);
     }
     while (file_exists("{$logo_dir}/{$name}")) {
         $name = rand(0, 9) . $name;
     }
     if (move_uploaded_file($_FILES['wdeb_logo']['tmp_name'], "{$logo_dir}/{$name}")) {
         if (defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) {
             $opts = $this->data->get_options('wdeb');
             $opts['wdeb_logo'] = "{$logo_path}/{$name}";
             $this->data->set_options($opts, 'wdeb');
         } else {
             update_option('wdeb_logo', "{$logo_path}/{$name}");
         }
     }
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:33,代码来源:class_wdeb_admin_pages.php


示例14: edd_create_protection_files

/**
 * Creates blank index.php and .htaccess files
 *
 * This function runs approximately once per month in order to ensure all folders
 * have their necessary protection files
 *
 * @since 1.1.5
 *
 * @param bool $force
 * @param bool $method
 */
function edd_create_protection_files($force = false, $method = false)
{
    if (false === get_transient('edd_check_protection_files') || $force) {
        $upload_path = edd_get_upload_dir();
        // Make sure the /edd folder is created
        wp_mkdir_p($upload_path);
        // Top level .htaccess file
        $rules = edd_get_htaccess_rules($method);
        if (edd_htaccess_exists()) {
            $contents = @file_get_contents($upload_path . '/.htaccess');
            if ($contents !== $rules || !$contents) {
                // Update the .htaccess rules if they don't match
                @file_put_contents($upload_path . '/.htaccess', $rules);
            }
        } elseif (wp_is_writable($upload_path)) {
            // Create the file if it doesn't exist
            @file_put_contents($upload_path . '/.htaccess', $rules);
        }
        // Top level blank index.php
        if (!file_exists($upload_path . '/index.php') && wp_is_writable($upload_path)) {
            @file_put_contents($upload_path . '/index.php', '<?php' . PHP_EOL . '// Silence is golden.');
        }
        // Now place index.php files in all sub folders
        $folders = edd_scan_folders($upload_path);
        foreach ($folders as $folder) {
            // Create index.php, if it doesn't exist
            if (!file_exists($folder . 'index.php') && wp_is_writable($folder)) {
                @file_put_contents($folder . 'index.php', '<?php' . PHP_EOL . '// Silence is golden.');
            }
        }
        // Check for the files once per day
        set_transient('edd_check_protection_files', true, 3600 * 24);
    }
}
开发者ID:Balamir,项目名称:Easy-Digital-Downloads,代码行数:45,代码来源:upload-functions.php


示例15: do_install_woocommerce

/**
 * Install woocommerce
 */
function do_install_woocommerce()
{
    global $woocommerce_settings, $woocommerce;
    // Do install
    woocommerce_default_options();
    woocommerce_tables_install();
    woocommerce_default_taxonomies();
    woocommerce_populate_custom_fields();
    // Install folder for uploading files and prevent hotlinking
    $upload_dir = wp_upload_dir();
    $downloads_url = $upload_dir['basedir'] . '/woocommerce_uploads';
    if (wp_mkdir_p($downloads_url) && !file_exists($downloads_url . '/.htaccess')) {
        if ($file_handle = fopen($downloads_url . '/.htaccess', 'w')) {
            fwrite($file_handle, 'deny from all');
            fclose($file_handle);
        }
    }
    // Install folder for logs
    $logs_url = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__))) . '/logs';
    if (wp_mkdir_p($logs_url) && !file_exists($logs_url . '/.htaccess')) {
        if ($file_handle = fopen($logs_url . '/.htaccess', 'w')) {
            fwrite($file_handle, 'deny from all');
            fclose($file_handle);
        }
    }
    // Clear transient cache (if this is an upgrade then woocommerce_class will be defined)
    if ($woocommerce instanceof woocommerce) {
        $woocommerce->clear_product_transients();
    }
    // Update version
    update_option("woocommerce_db_version", $woocommerce->version);
}
开发者ID:randyhoyt,项目名称:woocommerce,代码行数:35,代码来源:woocommerce-admin-install.php


示例16: register

 public function register()
 {
     $local_test = false;
     $fpd_css_url = $local_test ? 'http://radykal.dev/fpd3/css/jquery.fancyProductDesigner.css' : plugins_url('/css/jquery.fancyProductDesigner.min.css', FPD_PLUGIN_ROOT_PHP);
     $fpd_js_url = $local_test ? 'http://radykal.dev/fpd3/js/jquery.fancyProductDesigner.js' : plugins_url('/js/jquery.fancyProductDesigner.min.js', FPD_PLUGIN_ROOT_PHP);
     $fpd_js_url = get_option('fpd_debug_mode') == 'yes' ? plugins_url('/js/jquery.fancyProductDesigner.js', FPD_PLUGIN_ROOT_PHP) : $fpd_js_url;
     //register css files
     wp_register_style('fpd-icon-font', plugins_url('/css/icon-font.css', FPD_PLUGIN_ROOT_PHP), false, Fancy_Product_Designer::FPD_VERSION);
     $fonts_dir = WP_CONTENT_DIR . '/uploads/fpd_fonts';
     $fonts_css = $fonts_dir . '/jquery.fancyProductDesigner-fonts.css';
     if (!file_exists($fonts_css)) {
         if (!file_exists($fonts_dir)) {
             wp_mkdir_p($fonts_dir);
         }
         $handle = @fopen($fonts_css, 'w') or print 'Cannot open file:  ' . $fonts_css;
         fclose($handle);
     }
     wp_register_style('fpd-fonts', content_url('/uploads/fpd_fonts/jquery.fancyProductDesigner-fonts.css', FPD_PLUGIN_ROOT_PHP), false, Fancy_Product_Designer::FPD_VERSION);
     wp_register_style('fpd-plugins', plugins_url('/css/plugins.min.css', FPD_PLUGIN_ROOT_PHP), false, Fancy_Product_Designer::FPD_VERSION);
     wp_register_style('fpd-jquery-ui', plugins_url('/css/jquery-ui.css', FPD_PLUGIN_ROOT_PHP), false, Fancy_Product_Designer::FPD_VERSION);
     wp_register_style('jquery-fpd', $fpd_css_url, array('fpd-fonts', 'fpd-jquery-ui'), Fancy_Product_Designer::FPD_VERSION);
     wp_enqueue_style('font-awesome-4', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', false, '4.3.0');
     wp_register_style('fpd-jssocials-theme', plugins_url('/assets/jssocials/jssocials-theme-flat.css', FPD_PLUGIN_ROOT_PHP), false, '0.2.0');
     wp_register_style('fpd-jssocials', plugins_url('/assets/jssocials/jssocials.css', FPD_PLUGIN_ROOT_PHP), array('font-awesome-4', 'fpd-jssocials-theme'), '0.2.0');
     wp_register_script('fpd-jssocials', plugins_url('/assets/jssocials/jssocials.min.js', FPD_PLUGIN_ROOT_PHP), false, '0.2.0');
     //register js files
     wp_register_script('fpd-plugins', plugins_url('/js/plugins.js', FPD_PLUGIN_ROOT_PHP), false, Fancy_Product_Designer::FPD_VERSION);
     wp_register_script('fabric', plugins_url('/js/fabric.js', FPD_PLUGIN_ROOT_PHP), false, Fancy_Product_Designer::FPD_VERSION);
     wp_register_script('fpd-jquery-form', plugins_url('/js/jquery.form.min.js', FPD_PLUGIN_ROOT_PHP));
     $fpd_dep = array('jquery', 'jquery-ui-draggable', 'jquery-ui-resizable', 'jquery-ui-sortable', 'jquery-ui-slider', 'fabric');
     if (get_option('fpd_debug_mode') == 'yes' || $local_test) {
         array_push($fpd_dep, 'fpd-plugins');
     }
     wp_register_script('jquery-fpd', $fpd_js_url, $fpd_dep, Fancy_Product_Designer::FPD_VERSION);
 }
开发者ID:woakes070048,项目名称:fancy-product-designer-extended,代码行数:35,代码来源:class-scripts-styles.php


示例17: check_log_dir

function check_log_dir($dir)
{
    if (!is_dir($dir)) {
        $wp_upload_dir = wp_upload_dir();
        $dir = $wp_upload_dir['basedir'] . '/logs/';
    }
    $pathinfo = pathinfo($dir);
    $dirname = isset($pathinfo['dirname']) ? $pathinfo['dirname'] : NULL;
    if (!is_dir($dirname)) {
        return FALSE;
    }
    // force trailing slash!
    if (strrpos($dir, '/') != strlen($dir) - 1) {
        $dir .= '/';
    }
    // make directory if it doesnt exist
    if (!is_dir($dir)) {
        wp_mkdir_p($dir, 0755);
    }
    // change permissions if we cant write to it
    if (!is_writable($dir)) {
        @chmod($dir, 0755);
    }
    // test and make sure we can write to it
    if (!is_dir($dir) || !is_writable($dir)) {
        return FALSE;
    }
    // make sure htaccess is in place to protect log files
    if (!file_exists($dir . '.htaccess') && file_exists(__DIR__ . '/_htaccess.php')) {
        copy(__DIR__ . '/_htaccess.php', $dir . '.htaccess');
    }
    return $dir;
}
开发者ID:eaglstun,项目名称:dbug,代码行数:33,代码来源:functions.php


示例18: create_thumbnail_folder

 /**
  * nggGallery::get_thumbnail_folder()
  *
  * @param mixed $gallerypath
  * @param bool $include_Abspath
  * @return string $foldername
  */
 static function create_thumbnail_folder($gallerypath, $include_Abspath = TRUE)
 {
     if (!$include_Abspath) {
         $gallerypath = ABSPATH . $gallerypath;
     }
     if (!file_exists($gallerypath)) {
         return FALSE;
     }
     if (is_dir($gallerypath . '/thumbs/')) {
         return '/thumbs/';
     }
     if (is_admin()) {
         if (!is_dir($gallerypath . '/thumbs/')) {
             if (!wp_mkdir_p($gallerypath . '/thumbs/')) {
                 if (SAFE_MODE) {
                     nggAdmin::check_safemode($gallerypath . '/thumbs/');
                 } else {
                     nggGallery::show_error(__('Unable to create directory ', 'nggallery') . $gallerypath . '/thumbs !');
                 }
                 return FALSE;
             }
             return '/thumbs/';
         }
     }
     return FALSE;
 }
开发者ID:ayoayco,项目名称:upbeat,代码行数:33,代码来源:core.php


示例19: setUp

 /**
  * Setup the backup object
  *
  */
 public function setUp()
 {
     $this->backup = new HM\BackUpWordPress\Backup();
     $this->backup->set_type('database');
     $this->custom_path = WP_CONTENT_DIR . '/custom';
     wp_mkdir_p($this->custom_path);
 }
开发者ID:rolka,项目名称:backupwordpress,代码行数:11,代码来源:testBackupPropertiesTest.php


示例20: msp_save_custom_styles

/**
 * Get custom styles and store them in custom.css file or use inline css fallback
 * This function will be called by masterslider save handler
 *
 * @return void
 */
function msp_save_custom_styles()
{
    $uploads = wp_upload_dir();
    $css_dir = apply_filters('masterslider_custom_css_dir', $uploads['basedir'] . '/' . MSWP_SLUG);
    $css_file = $css_dir . '/custom.css';
    $css_terms = "/*\n===============================================================\n # CUSTOM CSS\n - Please do not edit this file. this file is generated by server-side code\n - Every changes here will be overwritten\n===============================================================*/\n\n";
    // Get all custom css styles
    $css = msp_get_all_custom_css();
    /**
     * Initialize the WP_Filesystem
     */
    global $wp_filesystem;
    if (empty($wp_filesystem)) {
        require_once ABSPATH . '/wp-admin/includes/file.php';
        WP_Filesystem();
    }
    if (wp_mkdir_p($css_dir) && !$wp_filesystem->put_contents($css_file, $css_terms . $css, 0644)) {
        // if the directory is not writable, try inline css fallback
        msp_update_option('custom_inline_style', $css);
        // save css rules as option to print as inline css
    } else {
        $custom_css_ver = msp_get_option('masterslider_custom_css_ver', '1.0');
        $custom_css_ver = (double) $custom_css_ver + 0.1;
        msp_update_option('masterslider_custom_css_ver', $custom_css_ver);
        // disable inline css output
        msp_update_option('custom_inline_style', '');
    }
}
开发者ID:blogfor,项目名称:king,代码行数:34,代码来源:msp-admin-functions.php



注:本文中的wp_mkdir_p函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_mod函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_mime_type_icon函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap