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


PHP fw_ext函数代码示例

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


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

示例1: enqueue_static

 /**
  * Called when builder is rendered
  */
 public function enqueue_static()
 {
     $shortcode_instance = fw_ext('shortcodes')->get_shortcode('section');
     wp_enqueue_style($this->get_builder_type() . '_item_type_' . $this->get_type(), $shortcode_instance->locate_URI('/includes/page-builder-section-item/static/css/styles.css'), array(), fw()->theme->manifest->get_version());
     wp_enqueue_script($this->get_builder_type() . '_item_type_' . $this->get_type(), $shortcode_instance->locate_URI('/includes/page-builder-section-item/static/js/scripts.js'), array('fw-events', 'underscore'), fw()->theme->manifest->get_version(), true);
     wp_localize_script($this->get_builder_type() . '_item_type_' . $this->get_type(), str_replace('-', '_', $this->get_builder_type() . '_item_type_' . $this->get_type() . '_data'), $this->get_item_data());
 }
开发者ID:HilderH,项目名称:emprendamos,代码行数:10,代码来源:class-page-builder-section-item.php

示例2: _action_fw_ext_page_builder_add_support

/**
 * Call add_post_type_support('{post-type}', 'fw-page-builder')
 * for post types checked on Page Builder Settings page.
 */
function _action_fw_ext_page_builder_add_support()
{
    $feature_name = fw_ext('page-builder')->get_supports_feature_name();
    foreach (array_keys(fw_get_db_ext_settings_option('page-builder', 'post_types')) as $slug) {
        add_post_type_support($slug, $feature_name);
    }
}
开发者ID:ExtPoint,项目名称:Unyson-PageBuilder-Extension,代码行数:11,代码来源:hooks.php

示例3: execute

 /**
  * {@inheritdoc}
  */
 public function execute(array $args, array $state = array())
 {
     if (!isset($args['dir'])) {
         return new WP_Error('no_dir', __('Dir not specified', 'fw'));
     }
     $dir = $args['dir'];
     if (file_exists($dir)) {
         if (!fw_ext_backups_rmdir_recursive($dir)) {
             return new WP_Error('rmdir_fail', __('Cannot remove directory', 'fw') . ': ' . $dir);
         }
     }
     if (!mkdir($dir, 0777, true)) {
         return new WP_Error('mkdir_fail', __('Cannot create directory', 'fw') . ': ' . $dir);
     }
     $backups_dir = fw_ext('backups')->get_backups_dir();
     if (!file_exists("{$backups_dir}/index.php")) {
         $contents = implode("\n", array('<?php', 'header(\'HTTP/1.0 403 Forbidden\');', 'die(\'<h1>Forbidden</h1>\');'));
         if (@file_put_contents("{$backups_dir}/index.php", $contents) === false) {
             return new WP_Error('index_create_fail', sprintf(__('Cannot create file: %s', 'fw'), "{$backups_dir}/index.php"));
         }
     }
     if (!file_exists("{$backups_dir}/.htaccess")) {
         $contents = implode("\n", array('Deny from all', '<IfModule mod_rewrite.c>', '    RewriteEngine On', '    RewriteRule . - [R=404,L]', '</IfModule>'));
         if (@file_put_contents("{$backups_dir}/.htaccess", $contents) === false) {
             return new WP_Error('htaccess_create_fail', sprintf(__('Cannot create file: %s', 'fw'), "{$backups_dir}/htaccess"));
         }
     }
     return true;
 }
开发者ID:azharijelek,项目名称:Unyson-Backups-Extension,代码行数:32,代码来源:class-fw-ext-backups-task-type-dir-clean.php

示例4: prepare_items

 public function prepare_items()
 {
     if (!is_null($this->total_items)) {
         return;
     }
     $this->total_items = count($this->_archives);
     $this->set_pagination_args(array('total_items' => $this->total_items, 'per_page' => $this->items_pre_page));
     /**
      * @var FW_Extension_Backups $backups
      */
     $backups = fw_ext('backups');
     /**
      * Prepare items for output
      */
     foreach ($this->_archives as $filename => $archive) {
         $time = get_date_from_gmt(gmdate('Y-m-d H:i:s', $archive['time']), get_option('date_format') . ' ' . get_option('time_format'));
         $filename_hash = md5($filename);
         $details = array();
         $details[] = $archive['full'] ? __('Full Backup', 'fw') : __('Content Backup', 'fw');
         if (function_exists('fw_human_bytes')) {
             $details[] = fw_human_bytes(filesize($archive['path']));
         }
         $details[] = fw_html_tag('a', array('href' => $backups->get_download_link($filename), 'target' => '_blank', 'id' => 'download-' . $filename_hash, 'data-download-file' => $filename), esc_html__('Download', 'fw'));
         $details[] = fw_html_tag('a', array('href' => '#', 'onclick' => 'return false;', 'id' => 'delete-' . $filename_hash, 'data-delete-file' => $filename, 'data-confirm' => __("Warning! \n" . "You are about to delete a backup, it will be lost forever. \n" . "Are you sure?", 'fw')), esc_html__('Delete', 'fw'));
         $this->items[] = array('cb' => fw_html_tag('input', array('type' => 'radio', 'name' => 'archive', 'value' => $filename, 'id' => 'archive-' . $filename_hash)), 'details' => '<div>' . $time . '</div>' . '<div>' . implode(' | ', $details) . '</div>');
     }
 }
开发者ID:azharijelek,项目名称:Unyson-Backups-Extension,代码行数:27,代码来源:class--fw-ext-backups-list-table.php

示例5: _get_value_from_input

 /**
  * @internal
  *
  * @param array $option
  * @param array|null|string $input_value
  *
  * @return array|bool|int|string
  */
 protected function _get_value_from_input($option, $input_value)
 {
     if (is_array($input_value) && !empty($input_value)) {
         fw_ext('forms')->set_db_settings_option('recaptcha-keys', $input_value);
     }
     return fw_ext('forms')->get_db_settings_option('recaptcha-keys', array());
 }
开发者ID:northpen,项目名称:northpen,代码行数:15,代码来源:class-fw-option-type-recaptcha.php

示例6: _get_value_from_input

 /**
  * @internal
  *
  * @param array $option
  * @param array|null|string $input_value
  *
  * @return array|bool|int|string
  */
 protected function _get_value_from_input($option, $input_value)
 {
     if (is_array($input_value) && !empty($input_value)) {
         fw_ext('mailer')->set_db_settings_option(null, fw_get_options_values_from_input($this->get_inner_options(), $input_value));
     }
     return fw_ext('mailer')->get_db_settings_option();
 }
开发者ID:chrisuehlein,项目名称:couponsite,代码行数:15,代码来源:class-fw-option-type-mailer.php

示例7: enqueue_static

 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' => __('Number', 'fw'), 'label' => __('Label', 'fw'), 'edit_label' => __('Edit Label', 'fw'), 'toggle_required' => __('Toggle mandatory field', 'fw'), 'edit' => __('Edit', 'fw'), 'delete' => __('Delete', 'fw')), 'defaults' => array('type' => $this->get_type(), 'width' => fw_ext('forms')->get_config('items/width'), 'options' => fw_get_options_values_from_input($this->get_options(), array()))));
     fw()->backend->enqueue_options_static($this->get_options());
 }
开发者ID:HilderH,项目名称:emprendamos,代码行数:7,代码来源:class-fw-option-type-form-builder-item-number.php

示例8: _enqueue

 public function _enqueue($data)
 {
     $uri = fw_ext('builder')->get_uri('/includes/option-types/builder/includes/templates/components/' . $this->get_type());
     $version = fw_ext('builder')->manifest->get_version();
     wp_enqueue_style('fw-option-builder-templates-' . $this->get_type(), $uri . '/styles.css', array('fw-option-builder-templates'), $version);
     wp_enqueue_script('fw-option-builder-templates-' . $this->get_type(), $uri . '/scripts.js', array('fw-option-builder-templates'), $version, true);
     wp_localize_script('fw-option-builder-templates-' . $this->get_type(), '_fw_option_type_builder_templates_' . $this->get_type(), array('l10n' => array('template_name' => __('Template Name', 'fw'), 'save_template' => __('Save Builder Template', 'fw'))));
 }
开发者ID:reardestani,项目名称:Unyson-Builder-Extension,代码行数:8,代码来源:class-fw-ext-builder-templates-component-full.php

示例9: get_thumbnails_data

 protected function get_thumbnails_data()
 {
     /**
      * @var FW_Shortcode $cf_shortcode
      */
     $cf_shortcode = fw_ext('shortcodes')->get_shortcode('contact_form');
     $cf_thumbnail = array(array('tab' => __('Content Elements', 'fw'), 'title' => __('Contact form', 'fw'), 'description' => __('Add a Contact Form', 'fw'), 'image' => $cf_shortcode->locate_URI('/static/img/page_builder.png')));
     return $cf_thumbnail;
 }
开发者ID:northpen,项目名称:northpen,代码行数:9,代码来源:class-page-builder-contact-form-item.php

示例10: widget

 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('fw_language_switcher_widget_title', $instance['title']) . $args['after_title'];
     }
     fw_ext('translation')->frontend_language_switcher();
     echo $args['after_widget'];
 }
开发者ID:albertso,项目名称:Unyson-Translation-Extension,代码行数:17,代码来源:class-fw-widget-language-switcher.php

示例11: execute

 /**
  * {@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;
 }
开发者ID:azharijelek,项目名称:Unyson-Backups-Extension,代码行数:61,代码来源:class-fw-ext-backups-task-type-image-sizes-remove.php

示例12: _init

 /**
  * @internal
  */
 public function _init()
 {
     if (is_admin() && fw_ext('page-builder')) {
         require $this->get_declared_path('/includes/page-builder-column-item/class-page-builder-column-item.php');
         /**
          * Note: A file is required from framework/extensions/shortcodes/includes/shortcode-template-components.php
          * because the shortcodes don't have includes/ functionality
          */
     }
 }
开发者ID:northpen,项目名称:northpen,代码行数:13,代码来源:class-fw-shortcode-column.php

示例13: get_thumbnails_data

 protected function get_thumbnails_data()
 {
     $column_shortcode = fw_ext('shortcodes')->get_shortcode('column');
     $builder_widths = fw_ext_builder_get_item_width($this->get_builder_type());
     $column_thumbnails = array();
     foreach ($builder_widths as $key => $value) {
         $column_thumbnails[$key] = array('tab' => __('Layout Elements', 'fw'), 'title' => apply_filters('fw_ext_shortcodes_column_title', $value['title'], $key), 'description' => apply_filters('fw_ext_shortcodes_column_description', sprintf(__('Add a %s column', 'fw'), $value['title']), $key), 'image' => $column_shortcode->locate_URI("/includes/page-builder-column-item/static/img/{$key}.png"), 'data' => array('width' => $key));
     }
     return apply_filters('fw_shortcode_column_thumbnails_data', $column_thumbnails);
 }
开发者ID:setcomunicacao,项目名称:setdigital,代码行数:10,代码来源:class-page-builder-column-item.php

示例14: render

 public function render($data)
 {
     $form = $data['form'];
     if (empty($form)) {
         return '';
     }
     $form_id = $data['id'];
     $this->set_db_data($this->get_name() . '-' . $form_id, $data);
     return $this->render_view('form', array('form_id' => $form_id, 'form_html' => fw_ext('forms')->render_form($form_id, $form, $this->get_name(), $submit_button = $this->render_view('submit', array('submit_button_text' => empty($data['submit_button_text']) ? __('Submit', 'fw') : $data['submit_button_text'], 'form_id' => $form_id)))));
 }
开发者ID:HilderH,项目名称:emprendamos,代码行数:10,代码来源:class-fw-extension-contact-forms.php

示例15: delete_data_from_old_location

 /**
  * Before 1.0.1 data was saved in a single wp option where all extensions save their data
  * https://github.com/ThemeFuse/Unyson-Forms-Extension/commit/8192e81ca04fd06b215fe938087b2d880d7d42cc?diff=unified#diff-ec141aa42759cc0c7735796a2c061f60R30
  *
  * @param string $form_id
  * @return array|null Deleted data
  */
 private static function delete_data_from_old_location($form_id)
 {
     /**
      * @var FW_Extension_Contact_Forms $contact_forms_extension
      */
     $contact_forms_extension = fw_ext('contact-forms');
     $data_key = $contact_forms_extension->get_name() . '-' . $form_id;
     if ($data = $contact_forms_extension->get_db_data($data_key)) {
         $contact_forms_extension->set_db_data($data_key, null);
     }
     return $data;
 }
开发者ID:northpen,项目名称:northpen,代码行数:19,代码来源:class--fw-ext-contact-form-db-data.php


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