HJI WP Membership Code Reference
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hook Reference
  • Slipstream API Docs

Namespaces

  • hji
    • AgentRoster
      • controllers
      • models
      • utils
    • common
      • factories
      • interfaces
      • models
      • utils
    • construction
      • admin
        • controllers
        • models
      • core
      • front
        • controllers
      • interfaces
      • models
        • listings
        • subdivisions
      • views
    • geofarms
      • common
      • controllers
      • models
      • widgets
    • homevalue
      • controllers
      • core
        • abstracts
      • models
    • lifestylefinder
    • listingstoblog
      • controllers
    • membership
      • abstracts
      • controllers
      • entities
      • extension
        • abstracts
        • interfaces
      • factories
      • includes
      • interfaces
      • models
        • data
        • webservice
          • abstracts
          • actions
          • interfaces
      • observers
      • services
    • recentsales
      • controllers
      • tinymce
      • widgets
    • ResponsiveIDX
      • abstracts
      • adapters
      • controllers
      • core
        • abstracts
      • entities
      • models
      • services
      • tinymce
      • utils
      • widgets
    • schools
      • controllers
      • tinymce
      • widgets
    • users
      • abstracts
      • admin
        • controllers
        • models
      • controllers
      • core
        • abstracts
      • entities
      • models
      • utils
  • None
  • REL
    • controllers
    • Models
    • Taxonomies
    • Utils
      • Convert
    • widgets

Classes

  • hji\AgentRoster\AgentRoster
  • hji\AgentRoster\controllers\AgentRosterAdmin
  • hji\AgentRoster\controllers\Testimonials
  • hji\AgentRoster\models\TestimonialsModel
  • hji\AgentRoster\utils\ContactForm
  • hji\common\factories\mcePluginFactory
  • hji\common\factories\WidgetTrioFactory
  • hji\common\interfaces\AbstractSettingsModel
  • hji\common\interfaces\Shortcode
  • hji\common\interfaces\Widget
  • hji\common\interfaces\WidgetShortcode
  • hji\common\models\Alerts
  • hji\common\models\GForms
  • hji\common\models\JsVars
  • hji\common\models\mcePluginModel
  • hji\common\models\Notices
  • hji\common\models\PluginJsVars
  • hji\common\utils\APIClient
  • hji\common\utils\Cookies
  • hji\common\utils\GFHelper
  • hji\common\utils\HTTP
  • hji\common\utils\ipAddress
  • hji\common\utils\MetaBoxes
  • hji\common\utils\Modal
  • hji\common\utils\Paths
  • hji\common\utils\SiteInfo
  • hji\common\utils\String
  • hji\common\utils\Updater
  • hji\common\utils\Validator
  • hji\common\utils\View
  • hji\common\utils\Views
  • hji\common\utils\WPCache
  • hji\common\utils\WPHelper
  • hji\construction\admin\AdminController
  • hji\construction\admin\controllers\GeneralPageController
  • hji\construction\admin\models\GeneralPageModel
  • hji\construction\App
  • hji\construction\core\Component
  • hji\construction\core\Controller
  • hji\construction\core\DataModel
  • hji\construction\core\DataObjectPostView
  • hji\construction\core\Model
  • hji\construction\core\Paths
  • hji\construction\core\PostModel
  • hji\construction\core\WebService
  • hji\construction\core\Widget
  • hji\construction\front\controllers\ListingsController
  • hji\construction\front\controllers\SubdivisionsController
  • hji\construction\front\FrontController
  • hji\construction\models\Images
  • hji\construction\models\Labels
  • hji\construction\models\listings\ListingModel
  • hji\construction\models\listings\ListingsGetFilters
  • hji\construction\models\listings\ListingsModel
  • hji\construction\models\listings\ListingsSearchFilters
  • hji\construction\models\NCSearchWidget
  • hji\construction\models\NCSearchWidgetViewModel
  • hji\construction\models\Pagination
  • hji\construction\models\Settings
  • hji\construction\models\subdivisions\SubdivisionModel
  • hji\construction\models\subdivisions\SubdivisionsGetFilters
  • hji\construction\models\subdivisions\SubdivisionsGetOptions
  • hji\construction\models\subdivisions\SubdivisionsModel
  • hji\construction\models\subdivisions\SubdivisionsSearchFilters
  • hji\construction\models\subdivisions\SubdivisionsSearchOptions
  • hji\construction\NewConstruction
  • hji\construction\ServiceContainer
  • hji\construction\views\ListingsView
  • hji\construction\views\SubdivisionsView
  • hji\geofarms\common\ImageResize
  • hji\geofarms\common\RewriteRules
  • hji\geofarms\controllers\AreaCache
  • hji\geofarms\controllers\CMB
  • hji\geofarms\controllers\CPT
  • hji\geofarms\controllers\FrontEnd
  • hji\geofarms\controllers\Settings
  • hji\geofarms\controllers\Shortcodes
  • hji\geofarms\controllers\Slipstream
  • hji\geofarms\controllers\Taxonomy
  • hji\geofarms\controllers\TinyMCE
  • hji\geofarms\controllers\UpdateNeighborhoods
  • hji\geofarms\GeoFarms
  • hji\geofarms\models\CMB
  • hji\geofarms\models\CPT
  • hji\geofarms\models\Settings
  • hji\geofarms\models\Slipstream
  • hji\geofarms\models\Taxonomy
  • hji\geofarms\models\TinyMCE
  • hji\geofarms\widgets\Display
  • hji\geofarms\widgets\Map
  • hji\homevalue\controllers\HomeValueTinyMCE
  • hji\homevalue\controllers\HomeValueWidget
  • hji\homevalue\controllers\Settings
  • hji\homevalue\controllers\Shortcodes
  • hji\homevalue\core\abstracts\Component
  • hji\homevalue\core\Controller
  • hji\homevalue\core\Model
  • hji\homevalue\HomeValue
  • hji\homevalue\models\Settings
  • hji\lifestylefinder\LifestyleFinder
  • hji\listingstoblog\controllers\ImportListings
  • hji\listingstoblog\controllers\Settings
  • hji\listingstoblog\ListingsToBlog
  • hji\membership\abstracts\Component
  • hji\membership\abstracts\Controller
  • hji\membership\abstracts\Model
  • hji\membership\controllers\APIClient
  • hji\membership\controllers\CommonScripts
  • hji\membership\controllers\Dependency
  • hji\membership\controllers\DependencyResolver
  • hji\membership\controllers\Dispatcher
  • hji\membership\controllers\Downloads
  • hji\membership\controllers\GForms
  • hji\membership\controllers\ProductManager
  • hji\membership\controllers\ProductRegistrar
  • hji\membership\controllers\RegistryEntry
  • hji\membership\controllers\RequireJs
  • hji\membership\controllers\Settings
  • hji\membership\controllers\UpdateManager
  • hji\membership\entities\Event
  • hji\membership\entities\UserActionEvent
  • hji\membership\extension\abstracts\Component
  • hji\membership\factories\ProductFactory
  • hji\membership\includes\CustomerInfoSynchronizer
  • hji\membership\interfaces\Product
  • hji\membership\Membership
  • hji\membership\models\APIClientModel
  • hji\membership\models\Customer
  • hji\membership\models\data\Address
  • hji\membership\models\data\Image
  • hji\membership\models\data\Images
  • hji\membership\models\data\Paging
  • hji\membership\models\data\Sorting
  • hji\membership\models\DependencyEntity
  • hji\membership\models\DependencyModel
  • hji\membership\models\PluginEntity
  • hji\membership\models\ProductDependencies
  • hji\membership\models\Settings
  • hji\membership\models\ThemeEntity
  • hji\membership\models\UserActionLogger
  • hji\membership\models\UserSession
  • hji\membership\models\webservice\abstracts\QueryProperties
  • hji\membership\models\webservice\abstracts\WebService
  • hji\membership\models\webservice\abstracts\WebServiceFilters
  • hji\membership\models\webservice\actions\ActionsSearchFilters
  • hji\membership\models\webservice\actions\ActionsWebService
  • hji\membership\models\webservice\WebServiceOptions
  • hji\membership\models\WpCatalog
  • hji\membership\observers\EventDispatcher
  • hji\membership\observers\EventLogger
  • hji\membership\services\CPT_Router
  • hji\membership\services\DependencyInjector
  • hji\membership\services\DependencyInjectorInterface
  • hji\membership\services\Request
  • hji\membership\services\Route
  • hji\membership\services\Router
  • hji\membership\services\ServiceContainer
  • hji\membership\services\SocialGraph
  • hji\recentsales\controllers\Shortcodes
  • hji\recentsales\RecentSales
  • hji\recentsales\tinymce\RecentSales
  • hji\recentsales\widgets\RecentSales
  • hji\ResponsiveIDX\abstracts\FilterSchema
  • hji\ResponsiveIDX\adapters\IdxAdapter
  • hji\ResponsiveIDX\adapters\LegalAdapter
  • hji\ResponsiveIDX\adapters\ListingAdapter
  • hji\ResponsiveIDX\controllers\BaseController
  • hji\ResponsiveIDX\controllers\IdxApp
  • hji\ResponsiveIDX\controllers\Pagination
  • hji\ResponsiveIDX\controllers\RecentlyViewed
  • hji\ResponsiveIDX\controllers\RegistrationForm
  • hji\ResponsiveIDX\controllers\Settings
  • hji\ResponsiveIDX\controllers\Upgrader
  • hji\ResponsiveIDX\core\abstracts\Component
  • hji\ResponsiveIDX\core\Controller
  • hji\ResponsiveIDX\core\Model
  • hji\ResponsiveIDX\entities\ComplianceRule
  • hji\ResponsiveIDX\entities\ListingEntity
  • hji\ResponsiveIDX\models\ComplianceModel
  • hji\ResponsiveIDX\models\ComplianceViewModel
  • hji\ResponsiveIDX\models\FieldLabels
  • hji\ResponsiveIDX\models\HashMap
  • hji\ResponsiveIDX\models\IdxSearchModel
  • hji\ResponsiveIDX\models\MarketMetadata
  • hji\ResponsiveIDX\models\PaginationViewModel
  • hji\ResponsiveIDX\models\QuickSearchViewModel
  • hji\ResponsiveIDX\models\SearchFilters
  • hji\ResponsiveIDX\models\SearchParams
  • hji\ResponsiveIDX\models\SearchResultsViewModel
  • hji\ResponsiveIDX\models\ShortcodesModel
  • hji\ResponsiveIDX\models\SpatialMatchModel
  • hji\ResponsiveIDX\ResponsiveIDX
  • hji\ResponsiveIDX\services\ServiceContainer
  • hji\ResponsiveIDX\tinymce\FeaturedListings
  • hji\ResponsiveIDX\utils\ArrayFormat
  • hji\ResponsiveIDX\utils\PluginDependency
  • hji\ResponsiveIDX\utils\StringFormat
  • hji\ResponsiveIDX\utils\View
  • hji\ResponsiveIDX\widgets\FeaturedListings_TinyMCE
  • hji\ResponsiveIDX\widgets\FeaturedListings_Widget
  • hji\ResponsiveIDX\widgets\QuickSearch_Widget
  • hji\schools\controllers\Shortcodes
  • hji\schools\Schools
  • hji\schools\tinymce\Schools
  • hji\schools\widgets\Schools
  • hji\users\abstracts\AdminPageModel
  • hji\users\abstracts\UserAdminTable
  • hji\users\admin\AdminController
  • hji\users\admin\BaseController
  • hji\users\admin\controllers\ActionsPageController
  • hji\users\admin\controllers\UsersPageController
  • hji\users\admin\models\ActionsPageModel
  • hji\users\admin\models\UsersPageModel
  • hji\users\controllers\GravityForms
  • hji\users\controllers\GravityFormsAdmin
  • hji\users\controllers\RegistrationPrompter
  • hji\users\controllers\Settings
  • hji\users\controllers\SocialAuth
  • hji\users\controllers\User
  • hji\users\controllers\UserPanel
  • hji\users\core\abstracts\Component
  • hji\users\core\Controller
  • hji\users\core\Model
  • hji\users\entities\GFEntry
  • hji\users\entities\User
  • hji\users\entities\UserProfile
  • hji\users\models\ActionsSearchFilters
  • hji\users\models\ActionsWebServiceOptions
  • hji\users\models\FavoritesViewModel
  • hji\users\models\FrontEndNotices
  • hji\users\models\RegistrationNotificationViewModel
  • hji\users\models\Request
  • hji\users\models\Settings
  • hji\users\models\SettingsTab
  • hji\users\models\User
  • hji\users\models\UserActionsModel
  • hji\users\models\UserFactory
  • hji\users\models\UsersSearchModel
  • hji\users\Users
  • hji\users\utils\GravityFormsHelper
  • hji\users\utils\UserActionsTable
  • hji\users\utils\UserAuth
  • hji\users\utils\UserFavoritesTable
  • hji\users\utils\UserFormEntriesTable
  • hji\users\utils\UserListTable
  • hji\users\utils\UserSearchesTable
  • hji\users\utils\UserSessionsTable
  • REL\controllers\Admin
  • REL\controllers\FSBO
  • REL\controllers\PocketListings
  • REL\controllers\rIDXImport
  • REL\Models\ListingViewModel
  • REL\Models\rIDXImport
  • REL\Models\Upgrades
  • REL\RealEstateListings
  • REL\Taxonomies\CustomTaxonomies
  • REL\Utils\Convert\ListingConverter
  • REL\widgets\PocketListingsSearchWidget
  • REL\widgets\PocketListingsWidget
  • SM_API_Client

Interfaces

  • hji\construction\interfaces\IPost
  • hji\membership\extension\interfaces\ExtensionInterface
  • hji\membership\interfaces\CRUD
  • hji\membership\interfaces\Dispatchable
  • hji\membership\interfaces\EventDispatcherInterface
  • hji\membership\interfaces\Loggable
  • hji\membership\models\webservice\interfaces\IGettable
  • hji\membership\models\webservice\interfaces\ISearchable

Functions

  • __admin_redirect
  • get_pocket_listing
  • hji\membership\controllers\__inject_plugin_table
  • hji\membership\controllers\__inject_theme_table
  • hji_user_favorite_toggle
  • hjigf_display
  • hjigf_display_map
  • hjigf_get_community_feature
  • hjigf_get_post_thumbnail
  • hjigf_has_area_map
  • ridx_get_listing
  • ridx_is_results_page
  • ridx_is_single
  • ridx_is_single_print
  • table_hjpl_cache
   1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56   57   58   59   60   61   62   63   64   65   66   67   68   69   70   71   72   73   74   75   76   77   78   79   80   81   82   83   84   85   86   87   88   89   90   91   92   93   94   95   96   97   98   99  100  101  102  103  104  105  106  107  108  109  110  111  112  113  114  115  116  117  118  119  120  121  122  123  124  125  126  127  128  129  130  131  132  133  134  135  136  137  138  139  140  141  142  143  144  145  146  147  148  149  150  151  152  153  154  155  156  157  158  159  160  161  162  163  164  165  166  167  168  169  170  171  172  173  174  175  176  177  178  179  180  181  182  183  184  185  186  187  188  189  190  191  192  193  194  195  196  197  198  199  200  201  202  203  204  205  206  207  208  209  210  211  212  213  214  215  216  217  218  219  220  221  222  223  224  225  226  227  228  229  230  231  232  233  234  235  236  237  238  239  240  241  242  243  244  245  246  247  248  249  250  251  252  253  254  255  256  257  258  259  260  261  262  263  264  265  266  267  268  269  270  271  272  273  274  275  276  277  278  279  280  281  282  283  284  285  286  287  288  289  290  291  292  293  294  295  296  297  298  299  300  301  302  303  304  305  306  307  308  309  310  311  312  313  314  315  316  317  318  319  320  321  322  323  324  325  326  327  328  329  330  331  332  333  334  335  336  337  338  339  340  341  342  343  344  345  346  347  348  349  350  351  352  353  354  355  356  357  358  359  360  361  362  363  364  365  366  367  368  369  370  371  372  373  374  375  376  377  378  379  380  381  382  383  384  385  386  387  388  389  390  391  392  393  394  395  396  397  398  399  400  401  402  403  404  405  406  407  408  409  410  411  412  413  414  415  416  417  418  419  420  421  422  423  424  425  426  427  428  429  430  431  432  433  434  435  436  437  438  439  440  441  442  443  444  445  446  447  448  449  450  451  452  453  454  455  456  457  458  459  460  461  462  463  464  465  466  467  468  469  470  471  472  473  474  475  476  477  478  479  480  481  482  483  484  485  486  487  488  489  490  491  492  493  494  495  496  497  498  499  500  501  502  503  504  505  506  507  508  509  510  511  512  513  514  515  516  517  518  519  520  521  522  523  524  525  526  527  528  529  530  531  532  533  534  535  536  537  538  539  540  541  542  543  544  545  546  547  548  549  550  551  552  553  554  555  556  557  558  559  560  561  562  563  564  565  566  567  568  569  570  571  572  573  574  575  576  577  578  579  580  581  582  583  584  585  586  587  588  589  590  591  592  593  594  595  596  597  598  599  600  601  602  603  604  605  606  607  608  609  610  611  612  613  614  615  616  617  618  619  620  621  622  623  624  625  626  627  628  629  630  631  632  633  634  635  636  637  638  639  640  641  642  643  644  645  646  647  648  649  650  651  652  653  654  655  656  657  658  659  660  661  662  663  664  665  666  667  668  669  670  671  672  673  674  675  676  677  678  679  680  681  682  683  684  685  686  687  688  689  690  691  692  693  694  695  696  697  698  699  700  701  702  703  704  705  706  707  708  709  710  711  712  713  714  715  716  717  718  719  720  721  722  723  724  725  726  727  728  729  730  731  732  733  734  735  736  737  738  739  740  741  742  743  744  745  746  747  748  749  750  751  752  753  754  755  756  757  758  759  760  761  762  763  764  765  766  767  768  769  770  771  772  773  774  775  776  777  778  779  780  781  782  783  784  785  786  787  788  789  790  791  792  793  794  795  796  797  798  799  800  801  802  803  804  805  806  807  808  809  810  811  812  813  814  815  816  817  818  819  820  821  822  823  824  825  826  827  828  829  830  831  832  833  834  835  836  837  838  839  840  841  842  843  844  845  846  847  848  849  850  851  852  853  854  855  856  857  858  859  860  861  862  863  864  865  866  867  868  869  870  871  872  873  874  875  876  877  878  879  880  881  882  883  884  885  886  887  888  889  890  891  892  893  894  895  896  897  898  899  900  901  902  903  904  905  906  907  908  909  910  911  912  913  914  915  916  917  918  919  920  921  922  923  924  925  926  927  928  929  930  931  932  933  934  935  936  937  938  939  940  941  942  943  944  945  946  947  948  949  950  951  952  953  954  955  956  957  958  959  960  961  962  963  964  965  966  967  968  969  970  971  972  973  974  975  976  977  978  979  980  981  982  983  984  985  986  987  988  989  990  991  992  993  994  995  996  997  998  999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 
<?php
namespace hji\construction\models;


use hji\common\utils\Views;
use hji\construction\core\Model;
use hji\construction\core\View;
use hji\construction\models\subdivisions\SubdivisionModel;
use hji\construction\ServiceContainer;
use hji\membership\Membership;
use hji\ResponsiveIDX\ResponsiveIDX;
use hji\construction\core\Widget;


class NCSearchWidget extends Widget
{
    // Optional - if you want shortcode to validate attributes against these fields

    public static $supportedFields = array(
        'title',
        'polygon',
        'polynames',
        'layout',
        'expand_advanced_opt',
        'sortField',
        'sortOrder'
    );

    function __construct()
    {
        parent::__construct(
            'nc_search_widget', // Base ID
            __('HJI New Construction Search', 'hji_NewConstructionSearch'), // Name
            array( 'description' => __('Search widget for new construction communities.', 'hji_NewConstructionSearch' )) // Args
        );

        $this->services     = new ServiceContainer();
        $this->viewModel    = new NCSearchWidgetViewModel($this);
    }

    function widget($args, $instance)
    {
        if ($content = $this->getWidgetContent($args, $instance))
        {
            $before_widget = $after_widget = $before_title = $after_title = null;

            extract($args);

            $instance['title'] = (isset($instance['title'])) ? $instance['title'] : null;

            $title = apply_filters('widget_title', $instance['title']);

            echo $before_widget;

            if (!empty($title))
            {
                echo $before_title . $title . $after_title;
            }

            echo $content;

            echo $after_widget;
        }
    }


    public function getWidgetContent($args, $instance)
    {
        return $this->viewModel->getWidgetContent($args, $instance);
    }

    /**
     * Logic that goes inside WP_Widget::widget() before rendering
     *
     * @return array of variables that will be passed into the view
     */
    function prepareWidget($instance, $args)
    {
        return array(
            'instance' => $instance,
            'args'     => $args
        );
    }

    /**
     * Logic that goes inside WP_Widget::form() before rendering
     *
     * @return array of variables that will be passed into the view
     */
    function prepareForm($instance)
    {
        $defaults = array(
            'title'     => null,
            'polygon'   => null,
            'polynames' => null,
            'layout'    => 'vertical',
            'expand_advanced_opt'   => null,
            'sortField' => 'name',
            'sortOrder' => 'asc',
            'shortcode' => false
        );

        $instance = array_merge($defaults, $instance);

        $fields = array();

        foreach ($instance as $k => $v)
        {
            $fields[$k]['id']   = $this->get_field_id($k);
            $fields[$k]['name'] = $this->get_field_name($k);
            $fields[$k]['value']= $v;
        }

        return array(
            'instance' => $instance,
            'fields'   => $fields
        );
    }

    function getFormTemplateFile()
    {
        $paths = $this->services->getPaths();
        return $paths->getPath('templates/twig') . '/nc-search-widget-settings.twig';
    }

    function getWidgetTemplateFile()
    {

    }
}


class NCSearchWidgetViewModel extends Model
{
    function __construct(NCSearchWidget $searchWidget)
    {
        $this->_widget = $searchWidget;
    }


    /**
     * Returns search widget's HTML form for front-end rendering
     *
     * @param $args WP_Widget args
     * @param $instance WP_Widget instance
     * @return string
     */
    // TODO: refactor this method
    function getWidgetContent($args, $instance)
    {
        $output = '';

        $this->args = $args;
        $this->instance = $instance;

        extract($args);

        // Set widget layout

        if (isset($instance['layout']))
        {
            $vars['layout'] = $instance['layout'];
        }

        // Set processed settings for the instance, which can be
        // accessed via hooks

        $this->instanceSettings = $vars;

        // Prepare search forms for each listing type

        $vars['forms'][] = $this->_new_construction_search_form($instance);

        // Create Widget View

        $view = new Views(ResponsiveIDX::$views);

//        $vars = apply_filters('ridx_quick_search_widget', $vars, $args, $instance, $this->_widget->id);

        $content = $view->render('quick-search-widget', $vars);

        // Define widget wrapper classes

        $wrapperClasses = array(
            'hjitb',
            'quick-search-widget-wrapper'
        );

        if (isset($instance['layout']))
        {
            $wrapperClasses[] = $instance['layout'];
        }
        else
        {
            // Fallback to vertical layout

            $wrapperClasses[] = 'vertical';
        }

        $wrapperClasses = apply_filters('quick-search-wrapper-classes', $wrapperClasses, $instance);

        if (is_array($wrapperClasses) && !empty($wrapperClasses))
        {
            $output .= '<div class="' . implode($wrapperClasses, ' ') . '">';
        }
        else
        {
            $output .= '<div>';
        }

        $output .= $content;

        $output .= '</div>';

        return $output;
    }


    private function _new_construction_search_form($instance, $hide = false)
    {
        //Location
        $mainFields['polygon'] = $this->_polygon_field($instance);

        $mainFields['status'] = $this->_community_status_field();

        // Beds
        $beds_field = apply_filters('ridx_search_widget_beds_field', 'beds', array('beds', 'beds_baths', 'beds_range'), $this->_widget->id);

        switch($beds_field)
        {
            case 'beds_baths':
                $mainFields['beds_baths'] = $this->_beds_baths_field();
                break;

            case 'beds_range':
                $mainFields['beds_range'] = $this->_beds_range_field();
                break;

            case 'beds':
                $mainFields['beds'] = $this->_beds_field();
                break;
        }

        // Baths
        $baths_field = apply_filters('ridx_search_widget_baths_field', false, array('baths', 'baths_range'), $this->_widget->id);

        switch($baths_field)
        {
            case 'baths_range':
                $mainFields['baths_range'] = $this->_baths_range_field();
                break;

            case 'baths':
                $mainFields['baths'] = $this->_baths_field();
                break;
        }

        //Price range
        $mainFields['price_range'] = $this->_price_range_field();

        /** Advanced Search Options **/

        $advancedFields['builder']          = $this->_builder_field();
        $advancedFields['community_style']  = $this->_community_style_field();
        $advancedFields['size']             = $this->_living_area_field();
        $advancedFields['baths']            = $this->_baths_field();
        $advancedFields['multi_family']     = $this->_community_multifamily_field();
        $advancedFields['features']         = $this->_community_features_field();

        $formSettings = ($hide) ? array('atts' => array('style' => 'display: none')) : array('classes' => 'active');

        return $this->createForm('residential', $instance, $mainFields, $advancedFields, $formSettings);
    }


    private function _sort_order($instance = false)
    {
        if (!$sortField = $this->getParam('sortField'))
        {
            $sortField = (isset($instance['sortField'])) ? $instance['sortField'] : 'listingDate';
        }

        if (!$sortOrder = $this->getParam('sortOrder'))
        {
            $sortOrder = (isset($instance['sortOrder'])) ? $instance['sortOrder'] : 'desc';
        }

        $_sort = array(
            'type'          => 'hidden',
            'name'          => 'sortField',
            'atts'          => array(
                'id'            => 'sortfield',
            ),
            'value'         => $sortField
        );

        $_order = array(
            'type'          => 'hidden',
            'name'          => 'sortOrder',
            'atts'          => array(
                'id'            => 'sortorder',
            ),
            'value'         => $sortOrder
        );

        $sort = $this->createFormField($_sort);
        $order = $this->createFormField($_order);

        return $sort . $order;
    }


    private function _city_zip_field($instance = false)
    {
        $city = ($this->getParam('city')) ? $this->getParam('city') : null;
        $zip =  ($this->getParam('postal_code')) ? $this->getParam('postal_code') : null;

        $settings = array(
            'type'          => 'text',
            'name'          => 'city-zip',
            'label'         => 'City/Zip Code <span class="idx-icon-info"></span>',
            'atts'          => array(
                'id'            => 'city-zip',
            ),
            'value'         => $city . $zip
        );

        return $this->createFormField($settings);

        return $output;
    }


    private function _price_range_field($instance = false)
    {
        $prices = array(
            50000, 100000, 150000, 200000, 250000, 300000,
            350000, 400000, 450000, 500000,
            600000, 700000, 800000, 900000, 1000000,
            1100000, 1200000, 1300000, 1400000, 1500000,
            1600000, 1800000, 1900000, 2000000,
            2250000, 2500000, 2750000, 3000000,
            3250000, 3500000, 3750000, 4000000,
            4500000, 5000000, 6000000
        );

        foreach ($prices as $p)
        {
            $price_min[$p] = $price_max[$p] = '$' . number_format($p);
        }

        // Price range filter

        $price_min = apply_filters('ridx_search_widget_price_min', $price_min, $this->_widget->id);
        $price_max = apply_filters('ridx_search_widget_price_max', $price_max, $this->_widget->id);

        $price = $this->getParam('listPrice');

        $min = array(
            'type'          => 'select',
            'name'          => 'listPrice',
            'label'         => 'Price Min',
            'atts'          => array(
                'id'            => 'price_min',
            ),
            'value'         => $price_min,
            'currentValue'  => @$price[0],
            'isArray'       => true
        );

        $max = array(
            'type'          => 'select',
            'name'          => 'listPrice',
            'label'         => 'Price Max',
            'atts'          => array(
                'id'            => 'price_max',
            ),
            'value'         => $price_max,
            'currentValue'  => @$price[1],
            'isArray'       => true
        );

        $field1 = $this->createFormField($min);
        $field2 = $this->createFormField($max);

        return $this->rangeView($field1, $field2);
    }


    private function _lease_price_range_field($instance = false)
    {
        //Price
        $prices = array(
            500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1500, 1600, 1700, 1800,
            1800, 1900, 2000, 2250, 2500, 2750, 3000, 3250, 3500, 3750, 4000, 4500,
            5000, 5500, 6000, 6500, 7000, 7500, 8000, 8500, 9000, 9500, 10000
        );

        foreach ($prices as $p)
        {
            $price_min[$p] = $price_max[$p] = '$' . number_format($p);
        }

        // Price range filter

        $price_min = apply_filters('ridx_search_widget_lease_price_min', $price_min, $this->_widget->id);
        $price_max = apply_filters('ridx_search_widget_lease_price_max', $price_max, $this->_widget->id);

        $price = $this->getParam('listPrice');
        $price = (is_string($price) && stristr($price, ':')) ? explode(':', $price) : $price;

        $min = array(
            'type'          => 'select',
            'name'          => 'listPrice',
            'label'         => 'Price Min',
            'atts'          => array(
                'id'            => 'price_min',
            ),
            'value'         => $price_min,
            'currentValue'  => @$price[0],
            'isArray'       => true
        );

        $max = array(
            'type'          => 'select',
            'name'          => 'listPrice',
            'label'         => 'Price Max',
            'atts'          => array(
                'id'            => 'price_max',
            ),
            'value'         => $price_max,
            'currentValue'  => @$price[1],
            'isArray'       => true
        );

        $field1 = $this->createFormField($min);
        $field2 = $this->createFormField($max);

        return $this->rangeView($field1, $field2);
    }


    private function _beds_baths_field($instance = false)
    {
        $field1 = $this->_beds_field($instance);
        $field2 = $this->_baths_field($instance);

        return $this->rangeView($field1, $field2);
    }


    private function _beds_field($instance = false)
    {
        for ($i = 1; $i<= 6; $i++)
        {
            $_beds[$i . '+'] = $i . '+';
        }

        $_beds = apply_filters('ridx_search_widget_beds', $_beds, $this->_widget->id);

        $beds = $this->getParam('beds');
        $beds = $beds[0] . '+';

        $settings = array(
            'type'          => 'select',
            'name'          => 'beds',
            'label'         => 'Beds',
            'atts'          => array(
                'id'            => 'beds',
            ),
            'value'         => $_beds,
            'currentValue'  => $beds,
        );

        return $this->createFormField($settings);
    }


    private function _beds_range_field($instance = false)
    {
        for ($i = 1; $i<= 6; $i++)
        {
            $_beds_min[$i] = $_beds_max[$i] = $i;
        }

        $_beds_min = apply_filters('ridx_search_widget_beds_min', $_beds_min, $this->_widget->id);
        $_beds_max = apply_filters('ridx_search_widget_beds_max', $_beds_max, $this->_widget->id);

        $beds = $this->getParam('beds');

        $settingsMin = array(
            'type'          => 'select',
            'name'          => 'beds',
            'label'         => 'Beds Min',
            'atts'          => array(
                'id'            => 'beds_min',
            ),
            'value'         => $_beds_min,
            'currentValue'  => @$beds[0],
            'isArray'       => true
        );

        $settingsMax = array(
            'type'          => 'select',
            'name'          => 'beds',
            'label'         => 'Beds Max',
            'atts'          => array(
                'id'            => 'beds_max',
            ),
            'value'         => $_beds_max,
            'currentValue'  => @$beds[1],
            'isArray'       => true
        );

        $field1 = $this->createFormField($settingsMin);
        $field2 = $this->createFormField($settingsMax);

        return $this->rangeView($field1, $field2);
    }


    private function _baths_range_field($instance = false)
    {
        for ($i = 1; $i<= 6; $i++)
        {
            $_baths_min[$i] = $_baths_max[$i] = $i;
        }

        $_baths_min = apply_filters('ridx_search_widget_baths_min', $_baths_min, $this->_widget->id);
        $_baths_max = apply_filters('ridx_search_widget_baths_max', $_baths_max, $this->_widget->id);

        $baths = $this->getParam('baths');

        $settingsMin = array(
            'type'          => 'select',
            'name'          => 'baths',
            'label'         => 'Baths Min',
            'atts'          => array(
                'id'            => 'baths_min',
            ),
            'value'         => $_baths_min,
            'currentValue'  => @$baths[0],
            'isArray'       => true
        );

        $settingsMax = array(
            'type'          => 'select',
            'name'          => 'baths',
            'label'         => 'Baths Max',
            'atts'          => array(
                'id'            => 'baths_max',
            ),
            'value'         => $_baths_max,
            'currentValue'  => @$baths[1],
            'isArray'       => true
        );

        $field1 = $this->createFormField($settingsMin);
        $field2 = $this->createFormField($settingsMax);

        return $this->rangeView($field1, $field2);
    }


    private function _baths_field($instance = false)
    {
        for ($i = 1; $i<= 6; $i++)
        {
            $_baths[$i . '+'] = $i . '+';
        }

        $_baths = apply_filters('ridx_search_widget_baths', $_baths, $this->_widget->id);

        $baths = $this->getParam('baths');

        $settings = array(
            'type'          => 'select',
            'name'          => 'baths',
            'label'         => 'Baths',
            'atts'          => array(
                'id'            => 'baths',
            ),
            'value'         => $_baths,
            'currentValue'  => $baths[0] . '+',
        );

        return $this->createFormField($settings);
    }


    private function _searchResultsUrl($instance)
    {
        $subdivisionModel = new SubdivisionModel();
        $action = get_post_type_archive_link($subdivisionModel->getPostType());

        return $action;
    }


    private function _search_btn_field($instance = false, $listingType = false)
    {
        _deprecated_function(__FUNCTION__, 3.0, null);
    }


    private function _lost_size_field()
    {
        $values = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50);

        foreach ($values as $v)
        {
            $acres[$v . '+'] = $v . '+ Acres';
        }

        $acres = apply_filters('ridx_search_widget_acres', $acres, $this->_widget->id);

        $selected = $this->getParam('lotSize');

        $settings = array(
            'type'          => 'select',
            'name'          => 'lotSize',
            'label'         => 'Lot Size',
            'atts'          => array(
                'id'            => 'lot_size',
            ),
            'value'         => $acres,
            'currentValue'  => $selected[0] . '+',
        );

        return $this->createFormField($settings);
    }


    private function _living_area_field()
    {
        $selected = $this->getParam('size');

        $values = array(600, 800, 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3500, 4000, 4500, 5000, 5500, 6000);

        foreach ($values as $v)
        {
            $sqft[$v . '+'] = number_format($v) . '+ ft2';
        }

        $sqft = apply_filters('ridx_search_widget_sqft', $sqft, $this->_widget->id);

        $settings = array(
            'type'          => 'select',
            'name'          => 'size',
            'label'         => 'Home Size',
            'atts'          => array(
                'id'            => 'living_area',
            ),
            'value'         => $sqft,
            'currentValue'  => $selected[0] . '+',
        );

        return $this->createFormField($settings);
    }


    private function _living_area_year_built()
    {
        $field1 = $this->_living_area_field();
        $field2 = $this->_year_built_field();

        return $this->rangeView($field1, $field2);
    }


    private function _property_subtype_field($market, $property_type, $instance)
    {
        if (isset($instance['propertyType'][$market . ' ' . $property_type]) && !empty($instance['propertyType'][$market . ' ' . $property_type]))
        {
            $propertyTypes = $instance['propertyType'][$market . ' ' . $property_type];
        }
        else
        {
            $propertyTypes = $this->idxSearchModel->GetPropertySubTypes($market, $property_type);
        }

        $propertyTypes = apply_filters('ridx_search_widget_property_types', $propertyTypes, $market, $this->_widget->id);

        if (count($propertyTypes) > 0)
        {
            $selected = $this->getParam('propertyType');

            $settings = array(
                'type'          => 'select',
                'name'          => 'propertyType',
                'label'         => 'Property Type',
                'atts'          => array(
                    'id'            => 'property_subtype',
                    'multiple'      => 'multiple'
                ),
                'value'         => $propertyTypes,
                'currentValue'  => $selected,
                'isArray'       => true
            );

            return $this->createFormField($settings);
        }
    }


    private function _polygon_field($instance = false)
    {
        if ($polygon = $this->getParam('polygon'))
        {
            $polynames = $this->getParam('polynames');
        }
        else if (isset($instance['polygon']) && !empty($instance['polygon']))
        {
            $polygon = $instance['polygon'];
            $polynames = @$instance['polynames'];
        }

        if (is_array($polygon))
        {
            $polygon = implode('|', $polygon);
        }

        // Filter has to return array, which has to conatin ID => Label
        $polygon = apply_filters('ridx_search_widget_polygon', $polygon, $instance);

        // If array again, then we need to pre-populate polygons and polynames
        if (is_array($polygon))
        {
            $polynames = implode('|', $polygon);
            $polygon = array_keys($polygon);
            $polygon = implode('|', $polygon);
        }

        if (property_exists($this, 'market'))
        {
            $market = $this->market;
        }
        else
        {
            // If client only has one market, use it
            $markets = Membership::getInstance()->getMarkets();

            $market = (count($markets) == 1) ? $markets[0] : null;
        }

        $settings = array(
            'type'          => 'text',
            'name'          => 'polygon',
            'label'         => 'Location <span class="idx-icon-info"></span>',
            'labelAfterField' => false,
            'atts'          => array(
                'id'            => 'polygon',
                'data-lookup'   => 'polygon',
                'data-market'   => $market,
                'placeholder'   => 'City or zip'
            ),
            'value'         => $polygon,
            'isArray'       => false,
            'beforeField'        => '<label for="circle" data-type="nearbyToggle">Search Nearby  <span class="idx-icon-info"></span></label><div data-type="polygonFieldWrap">',
            'afterField'        => '</div><div data-type="nearbyFieldWrap"><input type="text" name="circle" data-type="circleInput" data-radius="10"></div>'
        );

        // Create a polynames field - which has to be located in the same container as polygon
        if (isset($polynames))
        {
            $settings['afterField'] = '<input type="hidden" class="polynames" name="polynames" value="' . $polynames . '">' . $settings['afterField'];
        }

        return $this->createFormField($settings);
    }


    private function _schoolDistrict_field($instance = false)
    {
        $settings = array(
            'type'          => 'text',
            'name'          => 'schoolDistrict',
            'label'         => 'School District',
            'atts'          => array(
                'id'            => 'schoolDistrict',
                'data-lookup'   => 'schoolDistrict',
                'data-market'   => $this->market
            ),
            'value'         => @$this->getParam('schoolDistrict'),
        );

        return $this->createFormField($settings);
    }


    private function _subdivision_field($instance = false)
    {
        $settings = array(
            'type'          => 'text',
            'name'          => 'subdivision',
            'label'         => 'Neighborhood <span class="idx-icon-info"></span>',
            'atts'          => array(
                'id'            => 'subdivision',
                'data-lookup'   => 'subdivision',
                'data-market'   => $this->market
            ),
            'value'         => @$this->getParam('subdivision'),
        );

        return $this->createFormField($settings);
    }


    private function _keyword_field($instance = false)
    {
        $settings = array(
            'type'          => 'text',
            'name'          => 'keyword',
            'label'         => 'MLS # or Keyword <span class="idx-icon-info"></span>',
            'atts'          => array(
                'id'            => 'keyword',
            ),
            'value'         => @$this->getParam('keyword'),
        );

        return $this->createFormField($settings);
    }


    private function _year_built_field($instance = false)
    {
        $year_built = $this->getParam('yearBuilt');

        $year = date('Y');

        for ($i=$year; $i>=1930; $i--)
        {
            if ($i < 1990)
            {
                $i -=9;
            }
            $v = $i . '+';
            $years[$v] = $v;
        }

        $settings = array(
            'type'          => 'select',
            'name'          => 'yearBuilt',
            'label'         => 'Year',
            'atts'          => array(
                'id'            => 'year_built',
            ),
            'value'         => $years,
            'currentValue'  => @$year_built[0] . '+'
        );

        return $this->createFormField($settings);
    }


    private function _dom_field($instance = false)
    {
        $settings = array(
            'type'          => 'text',
            'name'          => 'daysOnMarket',
            'label'         => 'Days On Market <span class="idx-icon-info"></span></label>',
            'atts'          => array(
                'id'            => 'dom',
            ),
            'after'         => '<span class="legend">Example: "3-" three or less days on market.</span></div>',
            'currentValue'  => @$this->getParam('dom')
        );

        return $this->createFormField($settings);
    }


    private function _distressed_field()
    {
        $settings = array(
            'type'          => 'checkbox',
            'name'          => 'distressed',
            'label'         => 'Distressed',
            'atts'          => array(
                'id'            => 'distressed',
            ),
            'value'         => '1',
            'currentValue'  => @$this->getParam('distressed'),
            'labelAfterField' => true
        );

        return $this->createFormField($settings);
    }


    private function _openhouse_field()
    {
        $settings = array(
            'type'          => 'checkbox',
            'name'          => 'openhouse',
            'label'         => 'Open House',
            'atts'          => array(
                'id'            => 'openhouse',
            ),
            'value'         => '1',
            'currentValue'  => @$this->getParam('openhouse'),
            'labelAfterField' => true
        );

        return $this->createFormField($settings);
    }


    private function _builder_field()
    {
        $settings = array(
            'type'          => 'text',
            'name'          => 'builder',
            'label'         => 'Builder',
            'atts'          => array(
                'id'            => 'builder',
            ),
            'value'         => @$this->getParam('builder'),
        );

        return $this->createFormField($settings);
    }


    private function _community_style_field()
    {
        $settings = array(
            'type'          => 'select',
            'name'          => 'style',
            'label'         => 'Community Style',
            'atts'          => array(
                'id'            => 'style',
            ),
            'value'         => array(
                'Adult'             => 'Adult',
                'Age-Restricted'    => 'Age-Restricted',
                'Condo Only'        => 'Condo Only',
                'Gated'             => 'Gated',
                'Master-Planned'    => 'Master-Planned'
            ),
            'currentValue'  => @$this->getParam('style')
        );

        return $this->createFormField($settings);
    }


    private function _community_status_field()
    {
        $statuses = array(
            'Active'        => 'Active',
            'Closeout'      => 'Closeout',
            'Coming Soon'   => 'Coming Soon',
            'Grand Opening' => 'Grand Opening'
        );

        $settings = array(
            'type'          => 'select',
            'name'          => 'status',
            'label'         => 'Community Status',
            'atts'          => array(
                'id'            => 'status',
                'multiple'      => 'multiple'
            ),
            'value'         => $statuses,
            'currentValue'  => @$this->getParam('status'),
            'isArray'       => true,
        );

        return $this->createFormField($settings);
    }


    private function _community_multifamily_field()
    {
        $settings = array(
            'type'          => 'checkbox',
            'name'          => 'multiFamily',
            'label'         => 'Multi-Family',
            'atts'          => array(
                'id'            => 'multiFamily',
            ),
            'value'         => '1',
            'currentValue'  => @$this->getParam('multiFamily'),
            'labelAfterField' => true
        );

        return $this->createFormField($settings);
    }


    private function _community_features_field()
    {
        $features = array(
            'golfCourse'    => 'Golf Course',
            'pool'          => 'Pool',
            'sports'        => 'Sport Facilities',
            'greenbelt'     => 'Green Belt',
            'park'          => 'Park'
        );

        $content = '';

        foreach ($features as $feature => $label)
        {
            $settings = array(
                'type'            => 'checkbox',
                'name'            => $feature,
                'label'           => $label,
                'atts'            => array(
                    'id' => $feature,
                ),
                'value'           => '1',
                'currentValue'    => @$this->getParam($feature),
                'labelAfterField' => true
            );

            $content .=  $this->createFormField($settings);
        }

        return $content;
    }


    // Mimicking WP_Widget functions

    function get_field_id($str)
    {
        return $this->_widget->get_field_id($str);
    }


    function get_field_name($str)
    {
        return $this->_widget->get_field_name($str);
    }


    /**
     * Returns quick search form HTML
     *
     * @param       $listingType
     * @param       $instance
     * @param array $mainFields
     * @param array $advancedFields
     * @param array $formSettings
     * @return bool|string
     */
    function createForm($listingType, $instance, array $mainFields, array $advancedFields, array $formSettings = array())
    {
        $default = array(
            'id'                => 'sm-quick-search-' . $listingType,
            'name'              => 'sm-quick-search',
            'classes'           => array(),
            'atts'              => array(),
            'action'            => $this->_searchResultsUrl($instance),
            'searchResultsUrl'  => $this->_searchResultsUrl($instance),
            'mainFields'        => $mainFields,
            'advancedFields'    => $advancedFields,
            'searchBtnLabel'    => 'Search Now',
            //            'doSettings'        => $this->_search_btn_field($instance, $listingType),
            'market'            => (property_exists($this, 'market')) ? $this->market : null,
            'listingType'       => $listingType,
            'widgetInstance'    => $instance
        );

        $default['searchBtnLabel'] = 'Search Communities';

        $default['hiddenFields']['sort_order'] = $this->_sort_order($instance);

        $vars = array_merge($default, $formSettings);

        $vars['collapsible'] = (!isset($this->instance['expand_advanced_opt']) || $this->instance['expand_advanced_opt'] != true || wp_is_mobile()) ? 'collapsible ' : '';

        $vars = apply_filters('ridx_search_form_' . $listingType, $vars, $this);
        $vars = apply_filters('ridx_search_form', $vars, $this);

        $view = $this->services()->getView();

        return $view->render('nc-search-widget-form.twig', $vars);
    }


    function createFormField(array $fieldSettings)
    {
        $view = new Views(ResponsiveIDX::$views);

        $class = (isset($fieldSettings['name'])) ? ' hji-' . strtolower($fieldSettings['name']) . '-wrap' : null;

        $default = array(
            'type'          => 'text',
            'name'          => false,
            'label'         => false,
            'labelAfterField' => false,
            'atts'          => array(),
            'before'        => '<div class="hji-fieldwrap'. $class .'">',
            'after'         => '</div>',
            'beforeField'   => false,
            'afterField'    => false,
            'value'         => false,
            'currentValue'  => null,
            'isArray'       => false,

        );

        $vars = array_merge($default, $fieldSettings);

        $vars['atts']['class'] = $vars['name'];

        $vars = apply_filters('ridx_search_form_field_' . $fieldSettings['name'], $vars, $this->instanceSettings, $this->_widget->id);

        if ($vars && !empty($vars))
        {
            return $view->render('quick-search-form-field', $vars);
        }
    }


    function rangeView($field1, $field2)
    {
        $view = new Views(ResponsiveIDX::$views);

        $vars = array(
            'field1'  => $field1,
            'field2'  => $field2
        );

        return $view->render('quick-search-range-fields', $vars);
    }


    /**
     * Returns search parameters value that were passed to the IdxSearchModel
     *
     * @param $param
     * @return array|null|string
     */
    public function getParam($param)
    {
        $services = new ServiceContainer();
        $request = $services->getRequest();

        if (!$searchParams = $request->get('hji-params'))
        {
            return null;
        }
        else
        {
            $searchParams = (object)$searchParams;
        }

        $return = null;

        // Turn param into an array if it's a numeric condition

        if (property_exists($searchParams, $param))
        {
            if ($val = $searchParams->$param)
            {
                if ($param == 'listingType' && is_string($val))
                {
                    $return = explode('|', $val);
                }
                else if(is_string($val) && is_numeric(substr($val, 0, -1)))
                {
                    $char = substr($val, -1);

                    if($char == '-')
                    {
                        $return[0] = '';
                        $return[1] = intval($val);
                    }
                    else if($char == '+')
                    {
                        $return[0] = intval($val);
                    }
                }
                else if (is_string($val))
                {
                    if(stristr($val, ':'))
                        $return = explode(':', $val);

                    if(stristr($val, '|'))
                        $return = explode('|', $val);
                }

                if (!$return)
                {
                    $return = $val;
                }
            }
        }

        return ($return) ? $return : null;
    }
}
HJI WP Membership Code Reference API documentation generated by ApiGen