本文整理汇总了PHP中fw_include_file_isolated函数的典型用法代码示例。如果您正苦于以下问题:PHP fw_include_file_isolated函数的具体用法?PHP fw_include_file_isolated怎么用?PHP fw_include_file_isolated使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fw_include_file_isolated函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _action_widgets_init
/**
* @internal
*/
public function _action_widgets_init()
{
$paths = array();
if (FW_CT) {
$paths[] = FW_CT_CUSTOM_DIR . '/theme/widgets';
}
$paths[] = FW_PT_CUSTOM_DIR . '/theme/widgets';
$included_widgets = array();
foreach ($paths as $path) {
$dirs = glob($path . '/*', GLOB_ONLYDIR);
if (!$dirs) {
continue;
}
foreach ($dirs as $dir_path) {
$dirname = basename($dir_path);
if (isset($included_widgets[$dirname])) {
// this happens when a widget in child theme wants to overwrite the widget from parent theme
continue;
} else {
$included_widgets[$dirname] = true;
}
fw_include_file_isolated($dir_path . '/class-fw-widget-' . $dirname . '.php');
register_widget('FW_Widget_' . fw_dirname_to_classname($dirname));
}
}
}
示例2: display_delete_page
private function display_delete_page()
{
$flash_id = 'fw_extensions_delete';
if (!$this->can_install()) {
FW_Flash_Messages::add($flash_id, __('You are not allowed to delete extensions.', 'fw'), 'error');
$this->js_redirect();
return;
}
$extensions = array_fill_keys(array_map('trim', explode(',', FW_Request::GET('extension', ''))), array());
if (!class_exists('_FW_Extensions_Delete_Upgrader_Skin')) {
fw_include_file_isolated(dirname(__FILE__) . '/includes/class--fw-extensions-delete-upgrader-skin.php');
}
$skin = new _FW_Extensions_Delete_Upgrader_Skin(array('title' => _n('Delete Extension', 'Delete Extensions', count($extensions), 'fw')));
$skin->header();
do {
$nonce = $this->get_nonce('delete');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!isset($_POST[$nonce['name']]) || !wp_verify_nonce($_POST[$nonce['name']], $nonce['action'])) {
$skin->error(__('Invalid nonce.', 'fw'));
}
if (!FW_WP_Filesystem::request_access(fw_get_framework_directory('/extensions'), fw_current_url(), array($nonce['name']))) {
break;
}
$uninstall_result = $this->uninstall_extensions($extensions, array('verbose' => $skin));
if (is_wp_error($uninstall_result)) {
$skin->error($uninstall_result);
} elseif (is_array($uninstall_result)) {
$error = array();
foreach ($uninstall_result as $extension_name => $extension_result) {
if (is_wp_error($extension_result)) {
$error[] = $extension_result->get_error_message();
}
}
$error = '<ul><li>' . implode('</li><li>', $error) . '</li></ul>';
$skin->error($error);
} elseif ($uninstall_result === true) {
$skin->set_result(true);
}
$skin->after(array('extensions_page_link' => $this->get_link()));
} else {
echo '<form method="post">';
wp_nonce_field($nonce['action'], $nonce['name']);
fw_render_view(dirname(__FILE__) . '/views/delete-form.php', array('extension_names' => array_keys($extensions), 'installed_extensions' => $this->get_installed_extensions(), 'list_page_link' => $this->get_link()), false);
echo '</form>';
}
} while (false);
$skin->footer();
}
示例3: enqueue_static
protected function enqueue_static()
{
$static_file = $this->locate_path('/static.php');
if ($static_file) {
fw_include_file_isolated($static_file);
}
}
示例4: include_extension_directory_all
/**
* Include all files from directory, from all extension's locations: framework, child, parent
* @param string|FW_Extension $extension
* @param string $extension_dir_rel_path
*/
private static function include_extension_directory_all($extension, $extension_dir_rel_path)
{
if (is_string($extension)) {
$extension = fw()->extensions->get($extension);
}
list($search_in_framework, $search_in_parent_theme, $search_in_child_theme) = $extension->correct_search_in_locations(true, true, true);
$rel_path = $extension->get_rel_path() . $extension_dir_rel_path;
$paths = array();
if ($search_in_framework) {
$paths[] = fw_get_framework_directory('/extensions' . $rel_path);
}
if ($search_in_child_theme) {
$paths[] = fw_get_stylesheet_customizations_directory('/extensions' . $rel_path);
}
if ($search_in_parent_theme) {
$paths[] = fw_get_template_customizations_directory('/extensions' . $rel_path);
}
foreach ($paths as $path) {
if ($files = glob($path . '/*.php')) {
foreach ($files as $dir_file_path) {
fw_include_file_isolated($dir_file_path);
}
}
}
}
示例5: die
<?php
if (!defined('FW')) {
die('Forbidden');
}
fw_include_file_isolated(dirname(__FILE__) . '/option-type-recaptcha/class-fw-option-type-recaptcha.php');
fw_include_file_isolated(dirname(__FILE__) . '/ReCaptcha/ReCaptcha.php');
fw_include_file_isolated(dirname(__FILE__) . '/ReCaptcha/RequestMethod.php');
fw_include_file_isolated(dirname(__FILE__) . '/ReCaptcha/RequestParameters.php');
fw_include_file_isolated(dirname(__FILE__) . '/ReCaptcha/Response.php');
fw_include_file_isolated(dirname(__FILE__) . '/ReCaptcha/RequestMethod/Post.php');
示例6: die
<?php
if (!defined('FW')) {
die('Forbidden');
}
/**
* @var array $archives
* @var bool $is_busy
*/
/**
* @var FW_Extension_Backups $backups
*/
$backups = fw_ext('backups');
if (!class_exists('_FW_Ext_Backups_List_Table')) {
fw_include_file_isolated(fw_ext('backups')->get_path('/includes/list-table/class--fw-ext-backups-list-table.php'));
}
$list_table = new _FW_Ext_Backups_List_Table(array('archives' => $archives));
$list_table->display();
示例7: die
<?php
if (!defined('FW')) {
die('Forbidden');
}
$ext_instance = fw()->extensions->get('portfolio');
fw_include_file_isolated($ext_instance->get_path('/static.php'));
if (!is_admin()) {
$settings = $ext_instance->get_settings();
if (is_tax($settings['taxonomy_name']) || is_post_type_archive($settings['post_type'])) {
wp_enqueue_script('fw-extension-' . $ext_instance->get_name() . '-mixitup', $ext_instance->locate_js_URI('jquery.mixitup.min'), array('jquery'), $ext_instance->manifest->get_version(), true);
wp_enqueue_script('fw-extension-' . $ext_instance->get_name() . '-script', $ext_instance->locate_js_URI('portfolio-script'), array('fw-extension-' . $ext_instance->get_name() . '-mixitup'), $ext_instance->manifest->get_version(), true);
}
}
示例8: esc_attr
?>
<form id="fw-ext-update-extensions" method="post" action="update-core.php?action=fw-update-extensions">
<div class="fw-ext-update-extensions-form-detailed" <?php
if ($one_update_mode) {
?>
style="display: none;"<?php
}
?>
>
<p><input class="button" type="submit" value="<?php
echo esc_attr(__('Update Extensions', 'fw'));
?>
" name="update"></p>
<?php
if (!class_exists('_FW_Ext_Update_Extensions_List_Table')) {
fw_include_file_isolated(fw()->extensions->get('update')->get_declared_path('/includes/classes/class--fw-ext-update-extensions-list-table.php'));
}
$list_table = new _FW_Ext_Update_Extensions_List_Table(array('extensions' => $updates['extensions']));
$list_table->display();
?>
<?php
wp_nonce_field(-1, '_nonce_fw_ext_update_extensions');
?>
<p><input class="button" type="submit" value="<?php
echo esc_attr(__('Update Extensions', 'fw'));
?>
" name="update"></p>
</div>
<?php
if ($one_update_mode) {
?>
示例9: include_extension_directory_all_locations
/**
* Include all files from directory, from all extension's locations: framework, child, parent
* @param string|FW_Extension $extension
* @param string $dir_rel_path
* @param bool $themeFirst
* false - [framework, parent, child]
* true - [child, parent, framework]
*/
private static function include_extension_directory_all_locations($extension, $dir_rel_path, $themeFirst = false)
{
if (is_string($extension)) {
$extension = fw()->extensions->get($extension);
}
$paths = $extension->get_customizations_locations();
$paths[$extension->get_path()] = $extension->get_uri();
if (!$themeFirst) {
$paths = array_reverse($paths);
}
foreach ($paths as $path => $uri) {
if ($files = glob($path . $dir_rel_path . '/*.php')) {
foreach ($files as $dir_file_path) {
fw_include_file_isolated($dir_file_path);
}
}
}
}
示例10: _action_update_framework
/**
* @internal
*/
public function _action_update_framework()
{
$nonce_name = '_nonce_fw_ext_update_framework';
if (!isset($_POST[$nonce_name]) || !wp_verify_nonce($_POST[$nonce_name])) {
wp_die(__('Invalid nonce.', 'fw'));
}
if (!class_exists('_FW_Ext_Update_Framework_Upgrader_Skin')) {
fw_include_file_isolated($this->get_declared_path('/includes/classes/class--fw-ext-update-framework-upgrader-skin.php'));
}
$skin = new _FW_Ext_Update_Framework_Upgrader_Skin(array('title' => __('Update Framework', 'fw')));
require_once ABSPATH . 'wp-admin/admin-header.php';
$skin->header();
$update = $this->get_framework_update(true);
do {
if ($update === false) {
$skin->error(__('Failed to get framework latest version.', 'fw'));
break;
} elseif (is_wp_error($update)) {
$skin->error($update);
break;
}
$context = $this->context;
if (!FW_WP_Filesystem::request_access($context, fw_current_url(), array($nonce_name))) {
break;
}
$this->maintenance_mode(true);
/** @var WP_Filesystem_Base $wp_filesystem */
global $wp_filesystem;
$tmp_download_dir = FW_WP_Filesystem::real_path_to_filesystem_path(FW_CACHE_DIR . '/update');
// just in case it already exists, clear everything, it may contain broken/old files
$wp_filesystem->rmdir($tmp_download_dir, true);
if (!FW_WP_Filesystem::mkdir_recursive($tmp_download_dir)) {
$skin->error(__('Cannot create directory: ' . $tmp_download_dir, 'fw'));
break;
}
$skin->feedback(__('Downloading framework...', 'fw'));
/** @var FW_Ext_Update_Service $service */
$service = $this->get_child($update['service']);
$downloaded_files_dir = $service->_download_framework($update['latest_version'], $tmp_download_dir);
if (!$downloaded_files_dir) {
$skin->error(__('Failed to download framework.', 'fw'));
break;
} elseif (is_wp_error($downloaded_files_dir)) {
$skin->error($downloaded_files_dir);
break;
}
$skin->feedback(__('Installing framework...', 'fw'));
$framework_dir = FW_WP_Filesystem::real_path_to_filesystem_path(FW_DIR);
// remove entire framework directory
$wp_filesystem->rmdir($framework_dir, true);
// move downloaded directory as new framework directory
$wp_filesystem->move($downloaded_files_dir, $framework_dir);
$skin->feedback(__('Framework updated.', 'fw'));
$wp_filesystem->delete($tmp_download_dir, true, 'd');
$skin->set_result(true);
$skin->after();
} while (false);
$this->maintenance_mode(false);
$skin->footer();
require_once ABSPATH . 'wp-admin/admin-footer.php';
}
示例11: _action_update_extensions
/**
* @internal
*/
public function _action_update_extensions()
{
$nonce_name = '_nonce_fw_ext_update_extensions';
if (!isset($_POST[$nonce_name]) || !wp_verify_nonce($_POST[$nonce_name])) {
wp_die(__('Invalid nonce.', 'fw'));
}
$form_input_name = 'extensions';
$extensions_list = FW_Request::POST($form_input_name);
if (empty($extensions_list)) {
FW_Flash_Messages::add('fw_ext_update', __('Please check the extensions you want to update.', 'fw'), 'warning');
wp_redirect(self_admin_url('update-core.php'));
exit;
}
if (is_string($extensions_list)) {
$extensions_list = json_decode($extensions_list);
} else {
$extensions_list = array_keys($extensions_list);
}
if (!class_exists('_FW_Ext_Update_Extensions_Upgrader_Skin')) {
fw_include_file_isolated($this->get_declared_path('/includes/classes/class--fw-ext-update-extensions-upgrader-skin.php'));
}
$skin = new _FW_Ext_Update_Extensions_Upgrader_Skin(array('title' => __('Extensions Update', 'fw')));
require_once ABSPATH . 'wp-admin/admin-header.php';
$skin->header();
do {
$original_post_value = $_POST[$form_input_name];
$_POST[$form_input_name] = wp_slash(json_encode($extensions_list));
if (!FW_WP_Filesystem::request_access(fw_get_framework_directory('/extensions'), fw_current_url(), array($nonce_name, $form_input_name))) {
// revert hack changes
$_POST[$form_input_name] = $original_post_value;
unset($original_post_value);
break;
}
// revert hack changes
$_POST[$form_input_name] = $original_post_value;
unset($original_post_value);
$updates = $this->get_extensions_with_updates();
if (empty($updates)) {
$skin->error(__('No extensions updates found.', 'fw'));
break;
}
foreach ($extensions_list as $extension_name) {
if (!($extension = fw()->extensions->get($extension_name))) {
$skin->error(sprintf(__('Extension "%s" does not exist or is disabled.', 'fw'), $extension_name));
continue;
}
if (!isset($updates[$extension_name])) {
$skin->error(sprintf(__('No update found for the "%s" extension.', 'fw'), $extension->manifest->get_name()));
continue;
}
$update = $updates[$extension_name];
if (is_wp_error($update)) {
$skin->error($update);
continue;
}
/** @var FW_Ext_Update_Service $service */
$service = $this->get_child($update['service']);
$update_result = $this->update(array('wp_fs_destination_dir' => FW_WP_Filesystem::real_path_to_filesystem_path($extension->get_declared_path()), 'download_callback' => array($service, '_download_extension'), 'download_callback_args' => array($extension, $update['latest_version'], $this->get_wp_fs_tmp_dir()), 'skin' => $skin, 'title' => sprintf(__('%s extension', 'fw'), $extension->manifest->get_name())), true);
if (is_wp_error($update_result)) {
$skin->error($update_result);
continue;
}
$skin->set_result(true);
if (!$this->get_config('extensions_as_one_update')) {
$skin->decrement_extension_update_count($extension_name);
}
}
if ($this->get_config('extensions_as_one_update')) {
$skin->decrement_extension_update_count($extension_name);
}
$skin->after();
} while (false);
$skin->footer();
require_once ABSPATH . 'wp-admin/admin-footer.php';
}
示例12: die
<?php
if (!defined('FW')) {
die('Forbidden');
}
fw_include_file_isolated(dirname(__FILE__) . '/option-type-recaptcha/class-fw-option-type-recaptcha.php');
foreach (array('ReCaptcha' => 'ReCaptcha', 'RequestMethod' => 'RequestMethod', 'RequestParameters' => 'RequestParameters', 'Response' => 'Response', 'Post' => 'RequestMethod/Post') as $classname => $location) {
if (!class_exists($classname)) {
fw_include_file_isolated(dirname(__FILE__) . '/ReCaptcha/' . $location . '.php');
}
}
示例13: include_extension_directory_all_locations
/**
* Include all files from directory, from all extension's locations: framework, child, parent
* @param string|FW_Extension $extension
* @param string $dir_rel_path
* @param bool $themeFirst
* false - [framework, parent, child]
* true - [child, parent, framework]
*/
private static function include_extension_directory_all_locations($extension, $dir_rel_path, $themeFirst = false)
{
if (is_string($extension)) {
$extension = fw()->extensions->get($extension);
}
$paths = $extension->get_customizations_locations();
$paths[$extension->get_path()] = $extension->get_uri();
if (!$themeFirst) {
$paths = array_reverse($paths);
}
foreach ($paths as $path => $uri) {
try {
$files = FW_File_Cache::get($cache_key = 'core:ext:glob:inc-all-php:' . $extension->get_name() . ':' . $path);
} catch (FW_File_Cache_Not_Found_Exception $e) {
$files = glob($path . $dir_rel_path . '/*.php');
FW_File_Cache::set($cache_key, $files);
}
if ($files) {
foreach ($files as $dir_file_path) {
fw_include_file_isolated($dir_file_path);
}
}
}
}
示例14: die
<?php
if (!defined('FW')) {
die('Forbidden');
}
fw_include_file_isolated(dirname(__FILE__) . '/includes/includes.php', true);
class FW_Option_Type_Form_Builder_Item_Recaptcha extends FW_Option_Type_Form_Builder_Item
{
protected $number_regex = '/^\\-?([\\d]+)?[,\\.]?([\\d]+)?$/';
public function get_type()
{
return 'recaptcha';
}
private function get_uri($append = '')
{
return fw_get_framework_directory_uri('/extensions/forms/includes/option-types/' . $this->get_builder_type() . '/items/' . $this->get_type() . $append);
}
public function get_thumbnails()
{
return array(array('html' => '<div class="item-type-icon-title" data-hover-tip="' . __('Add a Recaptcha field', 'fw') . '">' . '<div class="item-type-icon"><img src="' . esc_attr($this->get_uri('/static/images/icon.png')) . '" /></div>' . '<div class="item-type-title">' . __('Recaptcha', 'fw') . '</div>' . '</div>'));
}
public function enqueue_static()
{
wp_enqueue_style('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), $this->get_uri('/static/css/styles.css'));
wp_enqueue_script('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), $this->get_uri('/static/js/scripts.js'), array('fw-events'), false, true);
wp_localize_script('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), 'fw_form_builder_item_type_' . $this->get_type(), array('options' => $this->get_options(), 'l10n' => array('item_title' => __('Recaptcha', 'fw'), 'label' => __('Label', 'fw'), 'edit_label' => __('Edit Label', 'fw'), 'edit' => __('Edit', 'fw'), 'delete' => __('Delete', 'fw'), 'site_key' => __('Set site key', 'fw'), 'secret_key' => __('Set secret key', 'fw')), 'defaults' => array('type' => $this->get_type(), 'options' => fw_get_options_values_from_input($this->get_options(), array()))));
fw()->backend->enqueue_options_static($this->get_options());
}
private function get_options()
{
return array('label' => array('type' => 'text', 'label' => __('Label', 'fw'), 'desc' => __('Enter field label ( ite will be displayed on the web site )', 'fw'), 'value' => __('Recaptcha', 'fw')), 'recaptcha' => array('type' => 'recaptcha', 'label' => false, 'desc' => __('Please refer more details on how to configure ReCaptcha', 'fw') . ': <a href="https://www.google.com/recaptcha" target="_blank">https://www.google.com/recaptcha</a>', 'value' => null));
示例15: display_delete_page
private function display_delete_page()
{
$flash_id = 'fw_extensions_delete';
if (!$this->can_install()) {
FW_Flash_Messages::add($flash_id, __('You are not allowed to delete extensions.', 'fw'), 'error');
$this->js_redirect();
return;
}
$installed_extensions = $this->get_installed_extensions();
$extensions = array_fill_keys(array_map('trim', explode(',', FW_Request::GET('extension', ''))), array());
$error = '';
do {
foreach ($extensions as $extension_name => $x) {
if (empty($extension_name)) {
unset($extensions[$extension_name]);
continue;
}
if (!isset($installed_extensions[$extension_name])) {
$error = sprintf(__('Extension "%s" is not installed.', 'fw'), $this->get_extension_title($extension_name));
break 2;
}
}
if (empty($extensions)) {
$error = __('No extensions to delete.', 'fw');
break;
}
} while (false);
if ($error) {
FW_Flash_Messages::add($flash_id, $error, 'error');
$this->js_redirect();
return;
}
if (!class_exists('_FW_Extensions_Delete_Upgrader_Skin')) {
fw_include_file_isolated(dirname(__FILE__) . '/includes/class--fw-extensions-delete-upgrader-skin.php');
}
$skin = new _FW_Extensions_Delete_Upgrader_Skin(array('title' => _n('Delete Extension', 'Delete Extensions', count($extensions), 'fw')));
$skin->header();
do {
$nonce = $this->get_nonce('delete');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!isset($_POST[$nonce['name']]) || !wp_verify_nonce($_POST[$nonce['name']], $nonce['action'])) {
$skin->error(__('Invalid nonce.', 'fw'));
}
if (!FW_WP_Filesystem::request_access(fw_get_framework_directory('/extensions'), fw_current_url(), array($nonce['name']))) {
break;
}
// add sub-extensions for deletion
foreach (array_keys($extensions) as $extension_name) {
foreach ($this->collect_sub_extensions($extension_name, $installed_extensions) as $sub_extension_name => $sub_extension_data) {
$extensions[$sub_extension_name] = array();
}
}
$not_used_extensions = array_fill_keys(array_keys(array_diff_key($installed_extensions, $this->get_used_extensions($extensions, array_keys($installed_extensions)))), array());
$extensions = array_merge($extensions, $not_used_extensions);
/** @var WP_Filesystem_Base $wp_filesystem */
global $wp_filesystem;
foreach ($extensions as $extension_name => $x) {
if (!isset($installed_extensions[$extension_name])) {
$skin->error(sprintf(__('Extension "%s" is not installed.', 'fw'), $this->get_extension_title($extension_name)));
continue;
}
if (!isset($installed_extensions[$extension_name]['path']) || empty($installed_extensions[$extension_name]['path'])) {
// this happens sometimes, but I don't know why
fw_print($extension_name, $installed_extensions);
die;
}
$extension_title = $this->get_extension_title($extension_name);
$wp_fs_extension_path = FW_WP_Filesystem::real_path_to_filesystem_path($installed_extensions[$extension_name]['path']);
if (!$wp_filesystem->exists($wp_fs_extension_path)) {
// already deleted, maybe because it was a sub-extension of an deleted extension
continue;
}
$skin->feedback(sprintf(__('Deleting the "%s" extension...', 'fw'), $extension_title));
if (!$wp_filesystem->delete($wp_fs_extension_path, true, 'd')) {
$skin->error(sprintf(__('Cannot delete the "%s" extension.', 'fw'), $extension_title));
} else {
$skin->feedback(sprintf(__('%s extension successfully delete.', 'fw'), $extension_title));
$skin->set_result(true);
}
}
$db_active_extensions = fw()->extensions->_get_db_active_extensions();
$db_active_extensions = array_diff_key($db_active_extensions, $extensions);
update_option(fw()->extensions->_get_active_extensions_db_option_name(), $db_active_extensions);
unset($db_active_extensions);
$skin->after(array('extensions_page_link' => $this->get_link()));
} else {
echo '<form method="post">';
wp_nonce_field($nonce['action'], $nonce['name']);
fw_render_view(dirname(__FILE__) . '/views/delete-form.php', array('extension_names' => array_keys($extensions), 'installed_extensions' => $installed_extensions, 'list_page_link' => $this->get_link()), false);
echo '</form>';
}
} while (false);
$skin->footer();
}