当前位置: 首页>>代码示例>>PHP>>正文


PHP Path::get_path方法代码示例

本文整理汇总了PHP中Path::get_path方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::get_path方法的具体用法?PHP Path::get_path怎么用?PHP Path::get_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


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

示例1: tearDown

 public function tearDown()
 {
     if (file_exists(Path::get_path() . '/.files')) {
         unlink(Path::get_path() . '/.files');
     }
     $this->cleanup_test_data();
     delete_transient('hmbkp_directory_filesizes_running');
 }
开发者ID:humanmade,项目名称:backupwordpress,代码行数:8,代码来源:test-site-size.php

示例2: highlight

 public static function highlight($nav)
 {
     if (!empty(Path::get_path()['call_parts'][0])) {
         if (Path::get_path()['call_parts'][0] == $nav) {
             return 'active';
         }
     } else {
         if ($nav == 'index') {
             return 'active';
         }
     }
 }
开发者ID:marious,项目名称:php-cms,代码行数:12,代码来源:Template.php

示例3: backup

 /**
  * Perform a Backup.
  *
  * ## OPTIONS
  *
  * [--files_only]
  * : Backup files only, default to off
  *
  * [--database_only]
  * : Backup database only, defaults to off
  *
  * [--destination]
  * : dir that the backup should be save in, defaults to your existing backups directory
  *
  * [--root]
  * : dir that should be backed up, defaults to site root.
  *
  * [--archive_filename]
  * : filename for the resulting zip file
  *
  * [--excludes]
  * : list of paths you'd like to exclude
  *
  * ## Usage
  *
  *     wp backupwordpress backup [--files_only] [--database_only] [--path<dir>] [--root<dir>] [--zip_command_path=<path>] [--mysqldump_command_path=<path>]
  *
  * @todo errors should be bubbled from Backup, Scheduled_Backup and the like instead of being repeated.
  */
 public function backup($args, $assoc_args)
 {
     add_action('hmbkp_mysqldump_started', function () {
         \WP_CLI::line(__('Backup: Dumping database...', 'backupwordpress'));
     });
     add_action('hmbkp_archive_started', function () {
         \WP_CLI::line(__('Backup: Zipping everything up...', 'backupwordpress'));
     });
     if (!empty($assoc_args['destination'])) {
         Path::get_instance()->set_path($assoc_args['destination']);
     }
     Path::get_instance()->cleanup();
     if (!empty($assoc_args['root'])) {
         Path::get_instance()->set_root($assoc_args['root']);
     }
     if (!is_dir(Path::get_path())) {
         \WP_CLI::error(__('Invalid backup path', 'backupwordpress'));
         return false;
     }
     if (!is_dir(Path::get_root()) || !is_readable(Path::get_root())) {
         \WP_CLI::error(__('Invalid root path', 'backupwordpress'));
         return false;
     }
     $filename = 'backup.zip';
     if (isset($assoc_args['archive_filename'])) {
         $filename = $assoc_args['archive_filename'];
     }
     $hm_backup = new Backup($filename);
     if (!empty($assoc_args['files_only'])) {
         $hm_backup->set_type('file');
     }
     if (!empty($assoc_args['database_only'])) {
         $hm_backup->set_type('database');
     }
     if (!empty($assoc_args['excludes'])) {
         $hm_backup->set_excludes($assoc_args['excludes']);
     }
     $hm_backup->run();
     if (file_exists($hm_backup->get_backup_filepath())) {
         \WP_CLI::success(__('Backup Complete: ', 'backupwordpress') . $hm_backup->get_backup_filepath());
     } else {
         \WP_CLI::error(__('Backup Failed', 'backupwordpress'));
     }
 }
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:73,代码来源:class-backupwordpress-wp-cli-command.php

示例4: control

 public static function control()
 {
     $view = Path::get_path()['call_parts'][0];
     $addUrl = HOST_NAME . 'admin/' . $view . '/add';
     $editUrl = HOST_NAME . 'admin/' . $view . '/edit/';
     $deleteUrl = HOST_NAME . 'admin/' . $view . '/delete/';
     $allCategories = self::read("SELECT * FROM categories", PDO::FETCH_CLASS, __CLASS__);
     $table = '<a href="' . $addUrl . '" class="add-link">+ Add New Category</a>';
     $table .= '<table class="admin-table">
                 <tr>
                     <th width="3%">#</th>
                     <th>Category Name</th>
                     <th width="10%" colspan="2">Control</th>
                 </tr>
                 ';
     if ($allCategories != false) {
         if (is_object($allCategories)) {
             $table .= '<tr>
                         <td>' . $allCategories->id . '</td>
                          <td>' . $allCategories->name . '</td>
                          <td class="button">
                             <a href="' . $editUrl . $allCategories->id . '"><i class="fa fa-edit"></i></a>
                             <a href="' . $deleteUrl . $allCategories->id . '" class="delete"><i class="fa fa-trash-o"></i></a>
                          </td>
                     </tr>';
         } else {
             foreach ($allCategories as $category) {
                 $table .= '<tr>
                         <td>' . $category->id . '</td>
                          <td>' . $category->name . '</td>
                          <td class="button">
                             <a href="' . $editUrl . $category->id . '"><i class="fa fa-edit"></i></a>
                             <a href="' . $deleteUrl . $category->id . '" class="delete"><i class="fa fa-trash-o"></i></a>
                          </td>
                     </tr>';
             }
         }
     } else {
         $table .= '<tr><td colspan="4">No Categories Found</td></tr>';
     }
     $table .= '</table>';
     return $table;
 }
开发者ID:marious,项目名称:php-cms,代码行数:43,代码来源:Category.php

示例5: control

 public static function control()
 {
     $view = Path::get_path()['call_parts'][0];
     $editUrl = HOST_NAME . 'admin/' . $view . '/edit/';
     $deleteUrl = HOST_NAME . 'admin/' . $view . '/delete/';
     $users = self::read("SELECT * FROM Users WHERE id != " . User::theUser()->id, PDO::FETCH_CLASS, __CLASS__);
     $table = '<table class="admin-table">
                 <tr>
                     <th width="3%">#</th>
                     <th>Username</th>
                     <th width="10%" colspan="2">Control</th>
                 </tr>
                 ';
     if ($users != false) {
         if (is_object($users)) {
             $table .= '<tr>
                         <td>' . $users->id . '</td>
                          <td>' . $users->username . '</td>
                          <td class="button">
                             <a href="' . $editUrl . $users->id . '"><i class="fa fa-edit"></i></a>
                             <a href="' . $deleteUrl . $users->id . '" class="delete"><i class="fa fa-trash-o"></i></a>
                          </td>
                     </tr>';
         } else {
             foreach ($users as $item) {
                 $table .= '<tr>
                         <td>' . $item->id . '</td>
                          <td>' . $item->username . '</td>
                          <td class="button">
                             <a href="' . $editUrl . $item->id . '"><i class="fa fa-edit"></i></a>
                             <a href="' . $deleteUrl . $item->username . '" class="delete"><i class="fa fa-trash-o"></i></a>
                          </td>
                     </tr>';
             }
         }
     } else {
         $table .= '<tr><td colspan="4">No User Found</td></tr>';
     }
     $table .= '</table>';
     return $table;
 }
开发者ID:marious,项目名称:php-cms,代码行数:41,代码来源:User.php

示例6: backup_database

 public function backup_database()
 {
     if ($this->status) {
         $this->status->set_status(__('Backing up database...', 'backupwordpress'));
     }
     $database_backup_engines = apply_filters('hmbkp_database_backup_engines', array(new Mysqldump_Database_Backup_Engine(), new IMysqldump_Database_Backup_Engine()));
     // Set the file backup engine settings
     if ($this->database_dump_filename) {
         foreach ($database_backup_engines as &$backup_engine) {
             $backup_engine->set_backup_filename($this->database_dump_filename);
         }
     }
     // Dump the database
     $database_dump = $this->perform_backup($database_backup_engines);
     if (is_a($database_dump, __NAMESPACE__ . '\\Backup_Engine')) {
         $this->database_dump_filepath = $database_dump->get_backup_filepath();
     }
     // Fire up the file backup engines
     $file_backup_engines = apply_filters('hmbkp_file_backup_engines', array(new Zip_File_Backup_Engine(), new Zip_Archive_File_Backup_Engine()));
     // Set the file backup engine settings
     foreach ($file_backup_engines as &$backup_engine) {
         $backup_engine->set_backup_filename($this->backup_filename);
         $backup_engine->set_excludes(new Excludes(array('*.zip', 'index.html', '.htaccess', '.*-running')));
     }
     // Zip up the database dump
     $root = Path::get_root();
     Path::get_instance()->set_root(Path::get_path());
     $file_backup = $this->perform_backup($file_backup_engines);
     Path::get_instance()->set_root($root);
     if (is_a($file_backup, __NAMESPACE__ . '\\Backup_Engine')) {
         $this->backup_filepath = $file_backup->get_backup_filepath();
     }
     // Delete the Database Backup now that we've zipped it up
     if (file_exists($this->database_dump_filepath)) {
         unlink($this->database_dump_filepath);
     }
 }
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:37,代码来源:class-backup.php

示例7: get_user_excludes

 /**
  * Get the user defined excludes.
  *
  * @return array The array of excludes.
  */
 public function get_user_excludes()
 {
     $excludes = $this->excludes;
     // If path() is inside root(), exclude it.
     if (strpos(Path::get_path(), Path::get_root()) !== false && Path::get_root() !== Path::get_path()) {
         array_unshift($excludes, trailingslashit(Path::get_path()));
     }
     return $this->normalize($excludes);
 }
开发者ID:humanmade,项目名称:backupwordpress,代码行数:14,代码来源:class-excludes.php

示例8: recalculate_directory_filesize

/**
 *
 * @param null
 */
function recalculate_directory_filesize()
{
    if (!isset($_GET['hmbkp_recalculate_directory_filesize']) || !check_admin_referer('hmbkp-recalculate_directory_filesize')) {
        return;
    }
    // Delete the cached directory size
    @unlink(trailingslashit(Path::get_path()) . '.files');
    $url = add_query_arg(array('action' => 'hmbkp_edit_schedule', 'hmbkp_panel' => 'hmbkp_edit_schedule_excludes'), get_settings_url());
    if (isset($_GET['hmbkp_directory_browse'])) {
        $url = add_query_arg('hmbkp_directory_browse', sanitize_text_field($_GET['hmbkp_directory_browse']), $url);
    }
    wp_safe_redirect($url, '303');
    die;
}
开发者ID:crazyyy,项目名称:bessarabia,代码行数:18,代码来源:actions.php

示例9: set_server_config_notices

function set_server_config_notices()
{
    $notices = Notices::get_instance();
    $messages = array();
    if (!is_dir(Path::get_path())) {
        $messages[] = sprintf(__('The backups directory can\'t be created because your %s directory isn\'t writable. Please create the folder manually.', 'backupwordpress'), '<code>' . esc_html(dirname(Path::get_path())) . '</code>');
    }
    if (is_dir(Path::get_path()) && !wp_is_writable(Path::get_path())) {
        $messages[] = __('The backups directory isn\'t writable. Please fix the permissions.', 'backupwordpress');
    }
    if (Backup_Utilities::is_safe_mode_on()) {
        $messages[] = sprintf(__('%1$s is running in %2$s, please contact your host and ask them to disable it. BackUpWordPress may not work correctly whilst %3$s is on.', 'backupwordpress'), '<code>PHP</code>', sprintf('<a href="%1$s">%2$s</a>', __('http://php.net/manual/en/features.safe-mode.php', 'backupwordpress'), __('Safe Mode', 'backupwordpress')), '<code>' . __('Safe Mode', 'backupwordpress') . '</code>');
    }
    if (defined('HMBKP_PATH') && HMBKP_PATH) {
        // Suppress open_basedir warning https://bugs.php.net/bug.php?id=53041
        if (!path_in_php_open_basedir(HMBKP_PATH)) {
            $messages[] = sprintf(__('Your server has an %1$s restriction in effect and your custom backups directory (%2$s) is not within the allowed path(s): (%3$s).', 'backupwordpress'), '<code>open_basedir</code>', '<code>' . esc_html(HMBKP_PATH) . '</code>', '<code>' . esc_html(@ini_get('open_basedir')) . '</code>');
        } elseif (!file_exists(HMBKP_PATH)) {
            $messages[] = sprintf(__('Your custom path does not exist', 'backupwordpress'));
        } else {
            if (!is_dir(HMBKP_PATH)) {
                $messages[] = sprintf(__('Your custom backups directory %1$s doesn\'t exist and can\'t be created, your backups will be saved to %2$s instead.', 'backupwordpress'), '<code>' . esc_html(HMBKP_PATH) . '</code>', '<code>' . esc_html(Path::get_path()) . '</code>');
            }
            if (is_dir(HMBKP_PATH) && !wp_is_writable(HMBKP_PATH)) {
                $messages[] = sprintf(__('Your custom backups directory %1$s isn\'t writable, new backups will be saved to %2$s instead.', 'backupwordpress'), '<code>' . esc_html(HMBKP_PATH) . '</code>', '<code>' . esc_html(Path::get_path()) . '</code>');
            }
        }
    }
    if (!is_readable(Path::get_root())) {
        $messages[] = sprintf(__('Your site root path %s isn\'t readable.', 'backupwordpress'), '<code>' . Path::get_root() . '</code>');
    }
    if (!Requirement_Mysqldump_Command_Path::test() && !Requirement_PDO::test()) {
        $messages[] = sprintf(__('Your database cannot be backed up because your server doesn\'t support %1$s or %2$s. Please contact your host and ask them to enable them.', 'backupwordpress'), '<code>mysqldump</code>', '<code>PDO</code>');
    }
    if (count($messages) > 0) {
        $notices->set_notices('server_config', $messages, false);
    }
}
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:38,代码来源:interface.php

示例10: printf

			<td>

				<?php 
if (defined('HMBKP_PATH')) {
    ?>
					<p><?php 
    printf(__('You\'ve set it to: %s', 'backupwordpress'), '<code>' . esc_html(HMBKP_PATH) . '</code>');
    ?>
</p>
				<?php 
}
?>

				<p><?php 
printf(__('The path to the folder you would like to store your backup files in, defaults to %s.', 'backupwordpress'), '<code>' . esc_html(Path::get_path()) . '</code>');
?>
 <?php 
_e('e.g.', 'backupwordpress');
?>
 <code>define( 'HMBKP_PATH', '/home/willmot/backups' );</code></p>

			</td>

		</tr>

		<tr<?php 
if (defined('HMBKP_MYSQLDUMP_PATH')) {
    ?>
 class="hmbkp_active"<?php 
}
开发者ID:AcademicTechnologyCenter,项目名称:ATC-Quality-Tracking,代码行数:30,代码来源:constants.php

示例11: get_status_filepath

 /**
  * Get the path to the backup running file that stores the running backup status
  *
  * @return string
  */
 public function get_status_filepath()
 {
     return Path::get_path() . '/.backup-' . $this->id . '-running';
 }
开发者ID:AcademicTechnologyCenter,项目名称:ATC-Quality-Tracking,代码行数:9,代码来源:class-backup-status.php

示例12: cleanup

 /**
  * Clean any temporary / incomplete backups from the backups directory
  */
 public function cleanup()
 {
     // Don't cleanup a custom path, who knows what other stuff is there
     if (Path::get_path() === $this->get_custom_path()) {
         return;
     }
     foreach (new CleanUpIterator(new \DirectoryIterator($this->path)) as $file) {
         if ($file->isDot() || !$file->isReadable() || !$file->isFile()) {
             continue;
         }
         @unlink($file->getPathname());
     }
 }
开发者ID:crazyyy,项目名称:tarkettpolby,代码行数:16,代码来源:class-path.php

示例13: request_cancel_backup

/**
 * Cancels a running backup then redirect back to the backups page
 */
function request_cancel_backup()
{
    check_admin_referer('hmbkp_request_cancel_backup', 'hmbkp-request_cancel_backup_nonce');
    $schedule = new Scheduled_Backup(sanitize_text_field(urldecode($_GET['hmbkp_schedule_id'])));
    $status = $schedule->get_status();
    // Delete the running backup
    if ($status->get_backup_filename() && file_exists(trailingslashit(Path::get_path()) . $status->get_backup_filename())) {
        unlink(trailingslashit(Path::get_path()) . $status->get_backup_filename());
    }
    if (file_exists($status->get_status_filepath())) {
        unlink($status->get_status_filepath());
    }
    Path::get_instance()->cleanup();
    wp_safe_redirect(get_settings_url(), 303);
    die;
}
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:19,代码来源:actions.php

示例14:

    <?php 
if (isset(Path::get_path()['call_parts'][1])) {
    $catId = Path::get_path()['call_parts'][1];
    $cat = Category::read("SELECT * FROM categories WHERE id = ?", PDO::FETCH_CLASS, 'Category', [$catId]);
    if ($cat) {
        echo '<h2>' . $cat->name . '</h2>';
        echo '<p>' . $cat->content . '</p>';
    }
}
开发者ID:marious,项目名称:php-cms,代码行数:9,代码来源:categories.view.php

示例15: isset

<?php

$activate_code = isset(Path::get_path()['call_parts'][1]) ? Path::get_path()['call_parts'][1] : null;
if ($activate_code) {
    $user = User::read("SELECT * FROM users WHERE activation = ?", PDO::FETCH_CLASS, 'User', [$activate_code]);
    if ($user) {
        $user->activation = '';
        $user->status = 1;
        $user->save();
        echo '<p class="success">Your account has been activated</p>';
    } else {
        echo '<p class="error">This activation link doesn\'t exist</p>';
    }
} else {
    header('Location: ' . HOST_NAME);
}
开发者ID:marious,项目名称:php-cms,代码行数:16,代码来源:active.view.php


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