Example #1
0
/**
 * Settings form.
 *
 * @return string
 */
function wpcf_admin_general_settings_form()
{
    $settings = wpcf_get_settings();
    $form = array();
    $form['#form']['callback'] = 'wpcf_admin_general_settings_form_submit';
    $form['open-table'] = array('#type' => 'markup', '#markup' => '<table class="form-table"><tbody>');
    $form['images'] = array('#id' => 'add_resized_images_to_library', '#name' => 'wpcf_settings[add_resized_images_to_library]', '#title' => __('Remote Images', 'wpcf'), '#type' => 'checkbox', '#label' => __('Add resized images to the media library', 'wpcf'), '#description' => __('Types will automatically add the resized images as attachments to the media library. Choose this to automatically upload resized images to a CDN.', 'wpcf'), '#inline' => true, '#default_value' => !empty($settings['add_resized_images_to_library']), '#pattern' => '<tr><th scope="row"><TITLE></th><td><ELEMENT><LABEL><DESCRIPTION>');
    $form['images_remote'] = array('#id' => 'images_remote', '#name' => 'wpcf_settings[images_remote]', '#type' => 'checkbox', '#label' => __('Allow resizing of remote images', 'wpcf'), '#description' => __('Types will try to scale remote images.', 'wpcf'), '#inline' => true, '#default_value' => !empty($settings['images_remote']), '#pattern' => '<br /><ELEMENT><LABEL><DESCRIPTION>');
    $form['images_remote_clear'] = array('#id' => 'images_remote_cache_time', '#name' => 'wpcf_settings[images_remote_cache_time]', '#type' => 'select', '#title' => __('Images cache', 'wpcf'), '#pattern' => sprintf('<br />%s', __('Invalidate cached images that are more than <ELEMENT> hours old.', 'wpcf')), '#options' => array(__('Never', 'wpcf') => '0', '24' => '24', '36' => '36', '48' => '48', '72' => '72'), '#inline' => true, '#default_value' => intval($settings['images_remote_cache_time']));
    $form['clear_images_cache'] = array('#type' => 'submit', '#name' => 'clear-cache-images', '#id' => 'clear-cache-images', '#attributes' => array('id' => 'clear-cache-images', 'class' => 'button-secondary'), '#value' => __('Clear Cached Images', 'wpcf'), '#inline' => true, '#pattern' => '<br /><ELEMENT>');
    $form['clear_images_cache_outdated'] = array('#id' => 'clear-cache-images-outdated', '#type' => 'submit', '#name' => 'clear-cache-images-outdated', '#attributes' => array('id' => 'clear-cache-images-outdated', 'class' => 'button-secondary'), '#value' => __('Clear Outdated Cached Images', 'wpcf'), '#inline' => true, '#pattern' => ' <ELEMENT></td></tr>');
    if (function_exists('icl_register_string')) {
        $form['register_translations_on_import'] = array('#id' => 'register_translations_on_import', '#name' => 'wpcf_settings[register_translations_on_import]', '#type' => 'checkbox', '#title' => __('WPML Integration', 'wpcf'), '#label' => __("When importing, add texts to WPML's String Translation table", 'wpcf'), '#inline' => true, '#default_value' => !empty($settings['register_translations_on_import']), '#pattern' => '<tr><th scope="row"><TITLE></th><td><ELEMENT><LABEL><DESCRIPTION></td></th>', '#inline' => true);
    }
    $form['help-box'] = array('#id' => 'help_box', '#name' => 'wpcf_settings[help_box]', '#type' => 'radios', '#options' => array('all' => array('#value' => 'all', '#title' => __("Show help box on all custom post editing screens", 'wpcf')), 'by_types' => array('#value' => 'by_types', '#title' => __("Show help box only on custom post types that were created by Types", 'wpcf')), 'no' => array('#value' => 'no', '#title' => __("Don't show help box on any custom post type editing screen", 'wpcf'))), '#inline' => true, '#default_value' => $settings['help_box'], '#pattern' => '<tr><th scope="row"><TITLE></th><td><ELEMENT><DESCRIPTION></td></th>', '#title' => __('Help Box', 'wpcf'));
    $form['hide_standard_custom_fields_metabox'] = array('#id' => 'hide_standard_custom_fields_metabox', '#name' => 'wpcf_settings[hide_standard_custom_fields_metabox]', '#type' => 'radios', '#description' => __('This setting allow to hide standard WordPress Custom Field Metabox.', 'wpcf'), '#options' => array('all' => array('#value' => 'show', '#title' => __('Show standard WordPress Custom Field Metabox', 'wpcf')), 'by_types' => array('#value' => 'hide', '#title' => __('Hide standard WordPress Custom Field Metabox', 'wpcf'))), '#inline' => true, '#default_value' => preg_match('/^(show|hide)$/', $settings['hide_standard_custom_fields_metabox']) ? $settings['hide_standard_custom_fields_metabox'] : 'show', '#title' => __('Custom Field Metabox', 'wpcf'), '#pattern' => '<tr><th scope="row"><TITLE></th><td><ELEMENT><DESCRIPTION></td></th>');
    if (!WPCF_Types_Marketing_Messages::check_register()) {
        $form['toolset_messages'] = array('#id' => 'toolset_messages', '#name' => 'wpcf_settings[toolset_messages]', '#type' => 'checkbox', '#label' => __('Disable all messages about other Toolset components', 'wpcf'), '#default_value' => isset($settings['toolset_messages']) ? intval($settings['toolset_messages']) : 0, '#title' => __('Toolset Messages', 'wpcf'), '#pattern' => '<tr><th scope="row"><TITLE></th><td><ELEMENT><LABEL><DESCRIPTION></td></th>', '#inline' => true);
    }
    $form['postmeta-unfiltered-html'] = array('#id' => 'postmeta_unfiltered_html', '#name' => 'wpcf_settings[postmeta_unfiltered_html]', '#type' => 'radios', '#title' => __('Custom fields - unfiltered HTML', 'wpcf'), '#options' => array('on' => array('#value' => 'on', '#title' => __('Enable saving unfiltered HTML in Types custom fields for users with higher roles', 'wpcf')), 'off' => array('#value' => 'off', '#title' => __('Disable saving unfiltered HTML in Types custom fields for all users', 'wpcf'))), '#inline' => false, '#default_value' => $settings['postmeta_unfiltered_html'], '#pattern' => '<tr><th scope="row"><TITLE></th><td><ELEMENT><LABEL><DESCRIPTION></td></th>');
    $form['usermeta-unfiltered-html'] = array('#id' => 'usermeta_unfiltered_html', '#name' => 'wpcf_settings[usermeta_unfiltered_html]', '#type' => 'radios', '#title' => __('Usermeta fields - unfiltered HTML', 'wpcf'), '#options' => array('on' => array('#value' => 'on', '#title' => __("Enable saving unfiltered HTML in Types usermeta fields for users with higher roles", 'wpcf')), 'off' => array('#value' => 'off', '#title' => __("Disable saving unfiltered HTML in Types usermeta fields for all users", 'wpcf'))), '#inline' => false, '#default_value' => $settings['usermeta_unfiltered_html'], '#pattern' => '<tr><th scope="row"><TITLE></th><td><ELEMENT><LABEL><DESCRIPTION></td></th>');
    $form['open-close'] = array('#type' => 'markup', '#markup' => '</tbody></table>');
    $form['submit'] = array('#type' => 'submit', '#name' => 'submit', '#attributes' => array('id' => 'general-settings-submit', 'class' => 'button-primary'), '#value' => __('Save Changes', 'wpcf'));
    return $form;
}
    public function box_site_type()
    {
        $marketing = new WPCF_Types_Marketing_Messages();
        ?>
<div class="wrap wp-types select-kind">
    <p><?php 
        _e('<b>Select what kind of site you are building</b> and <b>we will advise you</b> about what features are needed and how to use them:', 'wpcf');
        ?>
</p>
    <form method="post">
        <?php 
        wp_nonce_field('update', 'marketing');
        ?>
        <?php 
        $marketing->kind_list();
        ?>
        <a href="#" id="wcpf-getting-started-button" class="button"><?php 
        _e('Show me!', 'wpcf');
        ?>
</a>
    </form>
</div>
<?php 
    }
<?php

$marketing = new WPCF_Types_Marketing_Messages();
$show_documentation_link = false;
if ($top = $marketing->show_top($update)) {
    echo '<div class="wpcf-notif">';
    echo $top;
    echo '</div>';
} else {
    $message = false;
    switch ($type) {
        case 'post_type':
            if ($update) {
                $message = __('Congratulations! Your Post Type %s was successfully updated.', 'wpcf');
            } else {
                $message = __('congratulations! your new Post Type %s was successfully created.', 'wpcf');
            }
            break;
        case 'fields':
            if ($update) {
                $message = __('Congratulations! Your custom fields group %s was successfully updated.', 'wpcf');
            } else {
                $message = __('Congratulations! Your new custom fields group %s was successfully created.', 'wpcf');
            }
            break;
        case 'taxonomy':
            if ($update) {
                $message = __('Congratulations! Your Taxonomy %s was successfully updated.', 'wpcf');
            } else {
                $message = __('Congratulations! Your new Taxonomy %s was successfully created.', 'wpcf');
            }
/**
 *
 */
function wpcf_admin_enqueue_scripts($hook)
{
    wp_register_script('marketing-getting-started', plugin_dir_url(__FILE__) . '/marketing/getting-started/assets/scripts/getting-started.js', array('jquery'), WPCF_VERSION, true);
    if (preg_match('@/marketing/getting-started/[^/]+.php$@', $hook)) {
        $marketing = new WPCF_Types_Marketing_Messages();
        wp_localize_script('marketing-getting-started', 'marketing_getting_started', array('id' => $marketing->get_option_name()));
        wp_enqueue_script('marketing-getting-started');
        wp_enqueue_style('marketing-getting-started', plugin_dir_url(__FILE__) . '/marketing/getting-started/assets/css/getting-started.css', array(), WPCF_VERSION, 'all');
    }
}
Example #5
0
<?php

/**
 *
 *
 */
include_once WPCF_ABSPATH . '/classes/class.wpcf-marketing-messages.php';
$marketing = new WPCF_Types_Marketing_Messages();
$marketing->update_options();
$content = $marketing->get_content();
if (empty($content) || isset($_GET['kind']) && !isset($_POST[$marketing->get_option_name()])) {
    $marketing->delete_option_kind();
    ?>
<div class="wrap wp-types select-kind">
    <h2><?php 
    _e('What kind of site are you building?', 'wcpf');
    ?>
</h2>
    <?php 
    settings_errors();
    ?>
    <p><?php 
    _e('Types plugin includes a lot of features and there are many possibilities. By selecting what kind of site you are building, you allow Types to advise you about what features are needed and how to use them.', 'wcpf');
    ?>
</p>
    <form method="post">
        <?php 
    wp_nonce_field('update', 'marketing');
    ?>
        <?php 
    $marketing->kind_list();