Exemple #1
0
 /**
  * Render addons installation and management screen.
  *
  * @param   string  $plugin_file  Either absolute path to plugin main file or plugin's identified name defined in WooRockets server.
  *
  * @return  void
  */
 public static function init($plugin_file)
 {
     // Hook into WordPress
     self::hook();
     // Get template path
     if ($tmpl = WR_CF_Loader::get_path('product/tmpl/addons.php')) {
         // Get product information
         $plugin = self::get($plugin_file);
         if (!$plugin) {
             die(__('Cannot get addons information for current product.', WR_CF_LIBRARY_TEXTDOMAIN));
         }
         // Check if user has customer account saved
         $customer_account = get_option('wr_cf_customer_account', null);
         $has_customer_account = is_array($customer_account) && !@empty($customer_account['username']) && !@empty($customer_account['password']);
         // Load template
         include_once $tmpl;
     }
 }
Exemple #2
0
    require_once WR_CONTACTFORM_PATH . '/includes/required.php';
    require_once WR_CONTACTFORM_PATH . '/includes/upload.php';
    $proFieldType = new WR_Contactform_Includes_Type();
    $proFieldRequired = new WR_Contactform_Includes_Required();
}
require_once WR_CONTACTFORM_PATH . 'libraries/loader.php';
require_once WR_CONTACTFORM_PATH . '/helpers/contactform.php';
require_once WR_CONTACTFORM_PATH . '/helpers/action-hook.php';
require_once WR_CONTACTFORM_PATH . '/helpers/ajax.php';
require_once WR_CONTACTFORM_PATH . '/helpers/sample-form.php';
require_once WR_CONTACTFORM_PATH . '/libraries/contactform.php';
require_once WR_CONTACTFORM_PATH . '/libraries/installer.php';
// Load Add-ons
include_once WR_CONTACTFORM_PATH . '/addons/mailchimp/main.php';
//Get Post Type
register_activation_hook(__FILE__, array('WR_Contactform_Installer', 'on_activate_function'));
register_uninstall_hook(__FILE__, array('WR_Contactform_Installer', 'on_uninstaller_function'));
// Register WR Sample Plugin initialization
add_action('wr_cf_init', 'wr_init_contactform_plugin');
// Register autoloader with WR_ prefix
WR_CF_Loader::register(WR_CONTACTFORM_PATH . 'libraries', 'WR_');
// Initialize WR Library
WR_CF_Init_Plugin::hook();
function wr_init_contactform_plugin()
{
    $WRContactform = new WR_Contactform();
    // Init admin pages
    $WRContactformLoadAjax = new WR_Contactform_Helpers_Ajax();
    // Redirect after plugin activation
    add_action('admin_init', array('WR_Contactform_Installer', 'do_activation_redirect'));
}
Exemple #3
0
 /**
  * Render the output.
  *
  * @param   string  $action  Gadget action to execute.
  *
  * @return  void
  */
 protected function render($action = 'default')
 {
     // Clean all buffered output
     while (ob_get_level()) {
         ob_end_clean();
     }
     // Get response
     $response = $this->get_response();
     // Tell browser that JSON string is returned
     @header('Content-Type: application/json');
     // Check if template file exists for requested gadget action
     $file = WR_CF_Loader::get_path("gadget/tmpl/{$this->gadget}/{$action}.php");
     if ('success' == $response['status'] && !empty($file)) {
         // Start output buffering
         ob_start();
         // Extract response array to variables: $status and $data
         extract($response);
         // Load template file to render output
         include_once $file;
         // Get final response
         $response['data'] = ob_get_clean();
         if (empty($response['data']) && $response != $this->get_response()) {
             $response = $this->get_response();
         }
     }
     // Print the JSON encoded response then xxit immediately to prevent WordPress from processing further
     exit(json_encode($response));
 }
Exemple #4
0
 /**
  * Render input field for user to interact with.
  *
  * @param   string  $tpl   Render field using this template.
  *
  * @return  string
  */
 protected function input($tpl = null)
 {
     // Prepare field template
     if (empty($tpl)) {
         $tpl = $this->type;
     }
     // Preset HTML code
     $html = '';
     // Backup current field attributes to allow recursive call
     $backup = $this->attributes;
     // Get path to template file
     $file = WR_CF_Loader::get_path("form/field/tmpl/{$tpl}.php");
     if (empty($file)) {
         $file = WR_CF_Loader::get_path('form/field/tmpl/text.php');
     }
     // Load field template
     ob_start();
     include $file;
     $html = ob_get_clean();
     // Restore field attributes
     $this->attributes = $backup;
     return $html;
 }
Exemple #5
0
 /**
  * Render form.
  *
  * @param   string   $alignment   Form alignment, either 'form-inline', 'form-horizontal' or leave empty for vertical alignment.
  * @param   array    $js_init     Print Javascript initialization for which: tabs, accordion, tips?
  * @param   string   $section_id  Which form section to render? Leave empty to render all sections by default.
  *
  * @return  void
  */
 public function render($alignment = null, $js_init = array('tips', 'accordions', 'tabs'), $section_id = '')
 {
     // Do 'wr_cf_pre_render_form' action
     do_action('wr_cf_pre_render_form', $this);
     // Render all form sections or a specified one?
     if (!empty($section_id) && array_key_exists($section_id, $this->fields)) {
         // Update Javascript initialization
         $js_init[] = 'ajax';
         // Backup current fields data
         $fields = $this->fields;
         // Remove data of unnecessary form section
         foreach (array_keys($this->fields) as $sid) {
             if ($section_id != $sid) {
                 unset($this->fields[$sid]['fields']);
                 unset($this->fields[$sid]['fieldsets']);
                 unset($this->fields[$sid]['accordion']);
                 unset($this->fields[$sid]['tabs']);
             }
         }
     }
     // Load assets
     //WR_CF_Init_Assets::load( array( 'wr-form-css', 'wr-form-js' ) );
     // Load form template
     if (!empty($alignment)) {
         $tpl = WR_CF_Loader::get_path("form/tmpl/form-{$alignment}.php");
     }
     if (isset($tpl) && !empty($tpl)) {
         include $tpl;
     } else {
         include WR_CF_Loader::get_path('form/tmpl/form.php');
     }
     // Render all form sections or a specified one?
     if (!empty($section_id) && array_key_exists($section_id, $this->fields)) {
         // Restore original fields data
         $this->fields = $fields;
     }
     // Do 'wr_cf_post_render_form' action
     do_action('wr_cf_post_render_form', $this);
 }
Exemple #6
0
        }
        ?>
" id="wr-form-section-<?php 
        esc_attr_e($sid);
        ?>
"<?php 
        if (isset($section['attributes'])) {
            echo ' ' . implode(' ', $section['attributes']);
        }
        ?>
>
<?php 
    }
    // Load section template
    if (!isset($_GET['ajax']) || !$_GET['ajax'] || empty($section_id) || $section_id == $sid) {
        include WR_CF_Loader::get_path('form/tmpl/section.php');
    }
    if ($numSection > 1 && empty($section_id) || !isset($_GET['ajax']) || !$_GET['ajax']) {
        ?>
			</div>
<?php 
    }
    $first = false;
}
// Check if this is an Ajax request for specific form section
if (empty($section_id) || !isset($_GET['ajax']) || !$_GET['ajax']) {
    ?>
	</div>
<?php 
    if (!isset($this->action)) {
        ?>
Exemple #7
0
 * Websites: http://www.woorockets.com
 */
// Check if this section has own template
$tmpl = WR_CF_Loader::get_path("form/tmpl/section/{$sid}.php");
// Check if a specific section is requested
if (empty($section_id) || $section_id == $sid) {
    if (!empty($tmpl)) {
        include $tmpl;
    } else {
        if (isset($section['fields'])) {
            $this->current_fields = $section['fields'];
            // Load fields template
            include WR_CF_Loader::get_path('form/tmpl/fields.php');
        }
        if (isset($section['fieldsets'])) {
            $this->current_fieldsets = $section['fieldsets'];
            // Load fieldsets template
            include WR_CF_Loader::get_path('form/tmpl/fieldsets.php');
        }
        if (isset($section['accordion'])) {
            $this->current_accordion = $section['accordion'];
            // Load accordion template
            include WR_CF_Loader::get_path('form/tmpl/accordion.php');
        }
        if (isset($section['tabs'])) {
            $this->current_tabs = $section['tabs'];
            // Load tabs template
            include WR_CF_Loader::get_path('form/tmpl/tabs.php');
        }
    }
}
 /**
  * Render the output.
  *
  * @return  void
  */
 public function admin_head()
 {
     include WR_CF_Loader::get_path('gadget/tmpl/email-settings/default.php');
     exit;
 }
Exemple #9
0
 /**
  * Search a file in registered paths.
  *
  * @param   string  $file  Relative file path to search for.
  *
  * @return  string
  */
 public static function get_path($file)
 {
     // Generate alternative file name
     $slave = str_replace('_', '-', $file);
     // Filter paths to search for file
     self::$paths = apply_filters('wr_cf_loader_get_path', self::$paths);
     foreach (array_reverse(self::$paths) as $base => $prefixes) {
         if (@is_file($base . '/' . $slave)) {
             return $base . '/' . $slave;
         } elseif (@is_file($base . '/' . $file)) {
             return $base . '/' . $file;
         }
     }
     return null;
 }
Exemple #10
0
    }
    ?>
" id="wr-form-tab-<?php 
    esc_attr_e($tid);
    ?>
">
			<?php 
    if (isset($tab['fields'])) {
        $this->current_fields = $tab['fields'];
        // Load fields template
        include WR_CF_Loader::get_path('form/tmpl/fields.php');
    }
    if (isset($tab['fieldsets'])) {
        $this->current_fieldsets = $tab['fieldsets'];
        // Load fieldsets template
        include WR_CF_Loader::get_path('form/tmpl/fieldsets.php');
    }
    if (isset($tab['accordion'])) {
        $this->current_accordion = $tab['accordion'];
        // Load accordion template
        include WR_CF_Loader::get_path('form/tmpl/accordion.php');
    }
    ?>
		</div>
		<?php 
    $first = false;
}
?>
	</div>
</div>
Exemple #11
0
		<div id="wr_<?php 
    esc_attr_e($aid);
    ?>
" class="panel-collapse collapse <?php 
    if ($first) {
        echo 'in';
    }
    ?>
">
			<div class="panel-body">
				<?php 
    if (isset($accordion['fields'])) {
        $this->current_fields = $accordion['fields'];
        // Load fields template
        include WR_CF_Loader::get_path('form/tmpl/fields.php');
    }
    if (isset($accordion['fieldsets'])) {
        $this->current_fieldsets = $accordion['fieldsets'];
        // Load fieldsets template
        include WR_CF_Loader::get_path('form/tmpl/fieldsets.php');
    }
    ?>
			</div>
		</div>
	</div>
<?php 
    $first = false;
}
?>
</div>