本文整理汇总了PHP中fw_get_framework_directory函数的典型用法代码示例。如果您正苦于以下问题:PHP fw_get_framework_directory函数的具体用法?PHP fw_get_framework_directory怎么用?PHP fw_get_framework_directory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fw_get_framework_directory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _render
/**
* Generate html
*
* @param string $id
* @param array $option Option array merged with _get_defaults()
* @param array $data {value => _get_value_from_input(), id_prefix => ..., name_prefix => ...}
*
* @return string HTML
* @internal
*/
protected function _render($id, $option, $data)
{
$defaults = $this->_get_defaults();
$option['preview'] = array_merge($defaults['preview'], $option['preview']);
$option['attr'] = array_merge($defaults['attr'], $option['attr']);
return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/view.php'), compact('id', 'option', 'data'));
}
示例2: fw_db_option_storage_type
/**
* @param null|string $type
* @return FW_Option_Storage_Type|FW_Option_Storage_Type[]|null
* @since 2.5.0
*/
function fw_db_option_storage_type($type = null)
{
static $types = null;
if (is_null($types)) {
$dir = fw_get_framework_directory('/includes/option-storage');
if (!class_exists('FW_Option_Storage_Type')) {
require_once $dir . '/class-fw-option-storage-type.php';
}
if (!class_exists('_FW_Option_Storage_Type_Register')) {
require_once $dir . '/class--fw-option-storage-type-register.php';
}
$access_key = new FW_Access_Key('fw:option-storage-register');
$register = new _FW_Option_Storage_Type_Register($access_key->get_key());
require_once $dir . '/type/class-fw-option-storage-type-post-meta.php';
$register->register(new FW_Option_Storage_Type_Post_Meta());
require_once $dir . '/type/class-fw-option-storage-type-wp-option.php';
$register->register(new FW_Option_Storage_Type_WP_Option());
do_action('fw:option-storage-types:register', $register);
$types = $register->_get_types($access_key);
}
if (empty($type)) {
return $types;
} elseif (isset($types[$type])) {
return $types[$type];
} else {
return null;
}
}
示例3: load_from_extensions_recursive
private static function load_from_extensions_recursive($extensions)
{
/*
* Loop each extension
* if it has a shortcodes folder load the shortcodes from it
* if an extension has subextensions then recursion
*/
foreach ($extensions as $ext_name => $children) {
$extension = fw()->extensions->get($ext_name);
$rel_path = $extension->get_rel_path();
// framework
$fw_path = fw_get_framework_directory('/extensions' . $rel_path . '/shortcodes');
if (file_exists($fw_path)) {
self::load_from_shortcodes_folder(array('path' => $fw_path, 'uri' => fw_get_framework_directory_uri('/extensions' . $rel_path . '/shortcodes')));
}
// parent theme framework-customizations
$parent_fws_path = fw_get_template_customizations_directory('/extensions' . $rel_path . '/shortcodes');
if (file_exists($parent_fws_path)) {
self::load_from_shortcodes_folder(array('path' => $parent_fws_path, 'uri' => fw_get_template_customizations_directory_uri('/extensions' . $rel_path . '/shortcodes')));
}
// child theme framework-customizations
if (is_child_theme()) {
$child_fws_path = fw_get_stylesheet_customizations_directory('/extensions' . $rel_path . '/shortcodes');
if (file_exists($child_fws_path)) {
self::load_from_shortcodes_folder(array('path' => $child_fws_path, 'uri' => fw_get_stylesheet_customizations_directory_uri('/extensions' . $rel_path . '/shortcodes')));
}
}
if (!empty($children)) {
self::load_from_extensions_recursive($children);
}
}
}
示例4: _render
/**
* Generate option's html from option array
* @param string $id
* @param array $option
* @param array $data
* @return string HTML
* @internal
*/
protected function _render($id, $option, $data)
{
unset($option['attr']['name'], $option['attr']['value']);
$option['attr']['data-for-js'] = json_encode(array('title' => empty($option['popup-title']) ? $option['label'] : $option['popup-title'], 'options' => $this->transform_options($option['popup-options']), 'template' => $option['template'], 'size' => $option['size'], 'limit' => $option['limit']));
$sortable_image = fw_get_framework_directory_uri('/static/img/sort-vertically.png');
return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/views/view.php'), compact('id', 'option', 'data', 'sortable_image'));
}
示例5: _render
/**
* @internal
*/
protected function _render($id, $option, $data)
{
wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array(), fw()->manifest->get_version());
wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('jquery'), fw()->manifest->get_version());
$output = fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/view.php'), array('id' => $id, 'option' => $option, 'data' => $data));
return $output;
}
示例6: _render
/**
* @internal
*/
protected function _render($id, $option, $data)
{
wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array('fw-selectize'), fw()->manifest->get_version());
wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('jquery', 'underscore', 'fw', 'fw-selectize'), fw()->manifest->get_version());
if (!self::$googleFontsPrinted) {
wp_localize_script('fw-option-' . $this->get_type(), 'googleFonts', self::$fonts['google']);
self::$googleFontsPrinted = true;
}
return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/view.php'), array('id' => $id, 'option' => $option, 'data' => $data, 'fonts' => self::$fonts));
}
示例7: _render
/**
* @internal
*/
protected function _render($id, $option, $data)
{
$option['properties']['type'] = 'single';
$option['properties']['from'] = isset($data['value']) ? $data['value'] : $option['value'];
if (isset($option['properties']['values']) && is_array($option['properties']['values'])) {
$option['properties']['from'] = array_search($option['properties']['from'], $option['properties']['values']);
}
$option['attr']['data-fw-irs-options'] = json_encode($this->default_properties($option['properties']));
return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/view.php'), array('id' => $id, 'option' => $option, 'data' => $data, 'value' => $data['value']));
}
示例8: _render
/**
* Generate option's html from option array
* @param string $id
* @param array $option
* @param array $data
* @return string HTML
* @internal
*/
protected function _render($id, $option, $data)
{
unset($option['attr']['name'], $option['attr']['value']);
wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array('fw'), fw()->manifest->get_version());
wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/' . $this->get_type() . '.js'), array('underscore', 'fw-events', 'jquery-ui-sortable', 'fw'), fw()->manifest->get_version(), true);
$transformed_options = $this->transform_options($option['popup-options']);
$localize_var_name = 'fw_option_type_' . str_replace('-', '_', $this->get_type()) . '_localize_' . md5(json_encode($transformed_options));
wp_localize_script('fw-option-' . $this->get_type(), $localize_var_name, array('title' => empty($option['popup-title']) ? $option['label'] : $option['popup-title'], 'options' => $this->transform_options($option['popup-options']), 'template' => $option['template']));
$option['attr']['data-localize-var-name'] = $localize_var_name;
fw()->backend->render_options($option['popup-options']);
// This makes sure that the option's static is enqueued
$sortable_image = fw_get_framework_directory_uri('/static/img/sort-vertically.png');
return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/views/view.php'), compact('id', 'option', 'data', 'sortable_image'));
}
示例9: _render
/**
* Generate option's html from option array
*
* @param string $id
* @param array $option
* @param array $data
*
* @return string HTML
* @internal
*/
protected function _render($id, $option, $data)
{
unset($option['attr']['name'], $option['attr']['value']);
$option['attr']['data-for-js'] = json_encode(array('title' => isset($option['popup-title']) ? $option['popup-title'] : (string) $option['label'], 'options' => $this->transform_options($option['popup-options']), 'button' => $option['button'], 'size' => $option['size'], 'custom-events' => $option['custom-events']));
if (!empty($data['value'])) {
if (is_array($data['value'])) {
$data['value'] = json_encode($data['value']);
}
} else {
$data['value'] = '';
}
$sortable_image = fw_get_framework_directory_uri('/static/img/sort-vertically.png');
return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/views/view.php'), compact('id', 'option', 'data', 'sortable_image'));
}
示例10: _render
/**
* @internal
*/
protected function _render($id, $option, $data)
{
wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array(), fw()->manifest->get_version());
wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('fw-events', 'jquery-ui-sortable'), fw()->manifest->get_version(), true);
if (empty($data['value']) || !is_array($data['value'])) {
$data['value'] = array();
}
$controls = array_merge(array('delete' => '<small class="dashicons dashicons-no-alt" title="' . esc_attr(__('Remove', 'fw')) . '"></small>'), $option['box-controls']);
if (isset($controls['delete'])) {
$_delete = $controls['delete'];
unset($controls['delete']);
$controls['delete'] = $_delete;
unset($_delete);
}
return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/view.php'), array('id' => $id, 'option' => $option, 'data' => $data, 'controls' => $controls));
}
示例11: _render
/**
* @internal
* {@inheritdoc}
*/
protected function _render($id, $option, $data)
{
if (empty($data['value']) || !is_array($data['value'])) {
$data['value'] = array();
}
$controls = array_merge(array('delete' => '<small class="dashicons dashicons-no-alt" title="' . esc_attr__('Remove', 'fw') . '"></small>'), $option['box-controls']);
if (isset($controls['delete'])) {
$_delete = $controls['delete'];
unset($controls['delete']);
$controls['delete'] = $_delete;
unset($_delete);
}
$box_options = array();
fw_collect_options($box_options, $option['box-options'], array('limit_option_types' => false, 'limit_container_types' => array('group'), 'limit_level' => 1));
$option['attr']['data-for-js'] = json_encode(array('options' => $this->transform_options($box_options), 'template' => $option['template']));
return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/view.php'), array('id' => $id, 'option' => $option, 'data' => $data, 'controls' => $controls, 'box_options' => $box_options));
}
示例12: render_sidebar
/**
* @param $color string
* @return html string of rendered widgets for current page
*/
public function render_sidebar($color)
{
if (!in_array($color, _FW_Extension_Sidebars_Config::$allowed_colors)) {
return false;
}
$preset = $this->get_current_page_preset();
//get available sidebar by color
$sidebar = isset($preset['sidebars'][$color]) ? $preset['sidebars'][$color] : null;
ob_start();
//check if sidebar is active
if (!empty($sidebar)) {
$sidebars_widgets = wp_get_sidebars_widgets();
if (!empty($sidebars_widgets[$sidebar])) {
dynamic_sidebar($sidebar);
} else {
echo fw_render_view(fw_get_framework_directory('/extensions/sidebars/views/frontend-no-widgets.php'), array('sidebar_id' => $sidebar));
}
}
return ob_get_clean();
}
示例13: __construct
public function __construct()
{
if (self::$loaded) {
trigger_error('Framework already loaded', E_USER_ERROR);
} else {
self::$loaded = true;
}
require fw_get_framework_directory('/core/class-fw-manifest.php');
require fw_get_framework_directory('/manifest.php');
/** @var array $manifest */
$this->manifest = new FW_Framework_Manifest($manifest);
add_action('fw_init', array($this, '_check_requirements'));
require fw_get_framework_directory('/core/extends/class-fw-extension.php');
require fw_get_framework_directory('/core/extends/class-fw-option-type.php');
require fw_get_framework_directory('/core/components/extensions.php');
$this->extensions = new _FW_Component_Extensions();
require fw_get_framework_directory('/core/components/backend.php');
$this->backend = new _FW_Component_Backend();
require fw_get_framework_directory('/core/components/theme.php');
$this->theme = new _FW_Component_Theme();
}
示例14: _action_init_framework
function _action_init_framework()
{
remove_action('after_setup_theme', '_action_init_framework');
include dirname(__FILE__) . '/bootstrap-helpers.php';
include dirname(__FILE__) . '/deprecated-constants.php';
require fw_get_framework_directory('/core/Fw.php');
fw();
/**
* Load helpers
*/
foreach (array('meta', 'class-fw-access-key', 'class-fw-dumper', 'general', 'class-fw-wp-filesystem', 'class-fw-cache', 'class-fw-form', 'class-fw-request', 'class-fw-session', 'class-fw-wp-option', 'class-fw-wp-post-meta', 'database', 'class-fw-flash-messages', 'class-fw-resize') as $file) {
require fw_get_framework_directory('/helpers/' . $file . '.php');
}
/**
* Load (includes) other functionality
*/
foreach (array('hooks', 'option-types') as $file) {
require fw_get_framework_directory('/includes/' . $file . '.php');
}
/**
* Init components
*/
foreach (fw() as $component_name => $component) {
if ($component_name === 'manifest') {
continue;
}
/** @var FW_Component $component */
$component->_call_init();
}
/**
* For Flash Message Helper:
* just start session before headers sent
* to prevent: Warning: session_start(): Cannot send session cookie - headers already sent, if flash added to late
*/
FW_Session::get(-1);
do_action('fw_init');
}
示例15: locate_path_URI
/**
* Search relative path in: child theme -> parent theme -> framework extensions directory and return URI
*
* @param string $rel_path '/<extension>/path_to_dir' or '/<extension>/extensions/<another_extension>/path_to_file.php'
* @param bool $search_in_framework
* @param bool $search_in_parent_theme
* @param bool $search_in_child_theme
* @return false|string URI or false if not found
*/
public function locate_path_URI($rel_path, $search_in_framework = true, $search_in_parent_theme = true, $search_in_child_theme = true)
{
if ($search_in_child_theme && is_child_theme()) {
if (file_exists(fw_get_stylesheet_customizations_directory('/extensions' . $rel_path))) {
return fw_get_stylesheet_customizations_directory_uri('/extensions' . $rel_path);
}
}
if ($search_in_parent_theme) {
if (file_exists(fw_get_template_customizations_directory('/extensions' . $rel_path))) {
return fw_get_template_customizations_directory_uri('/extensions' . $rel_path);
}
}
if ($search_in_framework) {
if (file_exists(fw_get_framework_directory('/extensions' . $rel_path))) {
return fw_get_framework_directory_uri('/extensions' . $rel_path);
}
}
return false;
}