banner_id = $banner_id; $this->spot = new AdfoxlySpotModel(); $this->format = new AdfoxlyFormatsModel(); $this->image = new AdfoxlyFormatImageModel(); $this->campaign = new AdfoxlyCampaignModel('adCampaign'); $this->places_settings = new AdfoxlyPlacesSettingsController(); $this->campaigns_settings = new AdfoxlyCampaignModel(); // model $this->banners = new AdfoxlyBannerModel(); // settings $this->settings_redirect = new AdfoxlySettingsRedirectModel(); $this->settings_statistics = new AdfoxlySettingsStatisticsModel(); $this->settings_pixel = new AdfoxlySettingsPixelModel(); $this->settings_adstxt = new AdfoxlySettingsAdstxtModel(); $this->settings_core = new AdfoxlySettingsCoreModel(); $this->settings_privacy = new AdfoxlySettingsPrivacyModel(); // $this->places_controller = new AdfoxlyPlacesController(); } /** * @param array $arguments * * This method generate form based on config arrays which are above * Forms are used in all places in dashboard * * @return string */ public function generate( array $arguments = array() ) { if ( ! empty( $arguments ) ) { foreach ( $arguments as $property => $argument ) { $this->{$property} = $argument; } if ( ! empty( $arguments[ 'type' ] ) ) { $output = ''; foreach ( $this->{$arguments[ 'type' ]}->meta_fields as $meta_field ) { if ( ! empty( $arguments[ 'banner_id' ] ) ) { $bannerController = new AdfoxlyBannerModel(); $this->banner_data = $bannerController->getBanner( $this->banner_id ); } $output .= $this->generate_field( $meta_field ); } return $output; } } } /** * @param $meta_field * * @return string */ public function generate_field( $meta_field ) { Timber::$locations = array( realpath( dirname( __DIR__ ) ) . '/view' ); $output = ''; $output1 = ''; $output2 = ''; if ( isset( $meta_field ) && isset( $meta_field[ 'type' ] ) ): switch ( $meta_field[ 'type' ] ): case ( $meta_field[ 'type' ] == "image_checkbox" || $meta_field[ 'type' ] == "image_radio" || $meta_field['type'] === 'image_radio_label'): if ( isset( $meta_field ) && ! empty( $meta_field ) && ! empty( $meta_field[ 'options' ] ) ) { if ( $meta_field['id'] === 'adfoxly-adzone-place' ) { // $content[ 'title' ] = 'Custom Places'; // $content[ 'subtitle' ] = 'If you choose a custom place, at the end you will get generated shortcode, which you can use on every spot on the site by inserting generated code in PHP file.'; // $output .= $groupHeader->render( $content ); $output .= $this->generate_options( $output2, $meta_field, array( 'category' => 'custom' ) ); $output .= '