/** 
	 * Constructor
	 * 
	 */
	public function __construct( $opts ) {

		parent::YD_Plugin( $opts );
		$this->form_blocks = $opts['form_blocks']; // YD Legacy (was to avoid "backlinkware")
		add_theme_support( 'post-formats', array( 'aside', 'gallery' ,'link' , 'image', 'quote', 'status', 'video', 'audio', 'chat') );
		
		if( is_admin() ) {
			
			/** our own filter and actions to plug the pro features into the free plugin **/
			add_filter( 'wpcufpn_src_type', array( $this, 'srcTypeFilter' ) );
			//add_filter('wpcufpn_terms_clauses', array( $this,'wpcufpn_terms_clauses'), 10, 3);
			add_action( 'wpcufpn_source_category_add_fields', array( $this, 'displayContentSourceCategoryTabAddFields' ) );
			add_action( 'wpcufpn_source_page_add_fields', array( $this, 'displayContentSourcePagesTabAddFields' ) );			
			//add_action( 'wpcufpn_displayandtheme_add_fields', array( $this, 'displayNumberOfLinesField' ) );
			add_action( 'wpcufpn_displaytheme_col1_add_fields', array( $this, 'displayDisplayThemeCol1AddFields' ) );
			add_action( 'wpcufpn_displayimagesource_crop_add_fields', array( $this, 'displayImageSourceCropAddFields' ) );
			add_action( 'wpcufpn_displayadvanced_add_fields', array( $this, 'displayAdvancedAddFields' ) );
			add_action( 'wpcufpn_display_about', array( $this, 'displayAbout' ) );
			
			add_filter( 'wpcufpn_themedirs', array( $this, 'themeDirsFilter' ) );
			
			/** Load calendar ui **/
			add_action('admin_enqueue_scripts', array( $this, 'loadAdminScripts' ) );
			add_action( 'wp_ajax_getTaxonomyWPLP', array( $this, 'getTaxonomyWPLP' ) );

			
		} else {
			
			/** front-end display **/
			//add_filter( 'wpcufpn_front_display', array( $this, 'displayFrontAdditionalSources' ), 10, 2 );
			add_filter( 'wpcufpn_src_category_args', array( $this, 'wpcufpn_src_category_argsFilter' ), 10, 2 );
		}
	}
Exemplo n.º 2
0
 /** 
  * Constructor
  * 
  */
 public function __construct($opts)
 {
     parent::YD_Plugin($opts);
     $this->form_blocks = $opts['form_blocks'];
     // YD Legacy (was to avoid "backlinkware")
     /** Check PHP and WP versions upon install **/
     register_activation_hook(dirname(dirname(__FILE__)), array($this, 'activate'));
     /** Setup default image **/
     $this->_field_defaults['default_img_previous'] = plugins_url(self::DEFAULT_IMG, dirname(__FILE__));
     $this->_field_defaults['default_img'] = plugins_url(self::DEFAULT_IMG, dirname(__FILE__));
     /** Sets up custom post types **/
     add_action('init', array($this, 'setupCustomPostTypes'));
     /** Register our widget (implemented in separate wp-fpn-widget.inc.php class file) **/
     add_action('widgets_init', function () {
         register_widget('wpcuFPN_Widget');
     });
     /** Register our shortcode **/
     add_shortcode('frontpage_news', array($this, 'applyShortcode'));
     if (is_admin()) {
         /** Load tabs ui + drag&drop ui **/
         add_action('admin_enqueue_scripts', array($this, 'loadAdminScripts'));
         /** Load admin css for tabs **/
         add_action('admin_init', array($this, 'addAdminStylesheets'));
         /** Customize custom post editor screen **/
         //add_action( 'admin_head', array( $this, 'changeIcon' ) );	//Unused
         add_action('admin_menu', array($this, 'setupCustomMetaBoxes'));
         add_action('admin_menu', array($this, 'setupCustomMenu'));
         add_action('save_post', array($this, 'saveCustomPostdata'));
         /** Customize Tiny MCE Editor **/
         add_action('admin_init', array($this, 'setupTinyMce'));
         add_action('in_admin_footer', array($this, 'editorFooterScript'));
         /** Tiny MCE 4.0 fix **/
         if (get_bloginfo('version') >= 3.9) {
             add_action('media_buttons', array($this, 'editorButton'), 1000);
             //1000 = put it at the end
         }
         if (!class_exists('wpcuWPFnProPlugin')) {
             add_filter('plugin_row_meta', array($this, 'addProLink'), 10, 2);
         }
     } else {
         /** Load our theme stylesheet on the front if necessary **/
         add_action('wp_print_styles', array($this, 'addStylesheet'));
         /** Load our fonts on the front if necessary **/
         add_action('wp_print_styles', array($this, 'addFonts'));
         /** Load our front-end slide control script **/
         //add_action( 'wp_print_scripts', array( $this, 'addFrontScript' ),0 );
         add_action('the_posts', array($this, 'prefixEnqueue'), 100);
         //add_action( 'after_setup_theme', array( $this, 'child_theme_setup' ) );
     }
 }
 /** 
  * Constructor
  * 
  */
 public function __construct($opts)
 {
     parent::YD_Plugin($opts);
     $this->form_blocks = $opts['form_blocks'];
     // YD Legacy (was to avoid "backlinkware")
     $this->appdeck_credentials = get_option('appdeck_credentials', array('api_secret' => '', 'api_key' => ''));
     $this->appdeck_settings = get_option('appdeck_settings', array('theme' => 'default'));
     /** Register the AppDeck menu for app templates **/
     register_nav_menu('appdeck_top', __('Main menu in the Appdeck mobile application', 'appdeck'));
     /*
     add_filter( 'template', array( $this, 'template' ) );
     add_filter( 'stylesheet', array( $this, 'stylesheet' ) );
     */
     if (is_admin()) {
         /** Create our admin menu and register our stylesheets **/
         add_action('admin_menu', array($this, 'setupCustomMenu'));
         /** Load admin css **/
         add_action('admin_init', array($this, 'addAdminStylesheets'));
         /** Load admin js **/
         add_action('admin_enqueue_scripts', array($this, 'loadAdminScripts'));
         /** ajax **/
         add_action('wp_ajax_appdeckconfig', array($this, 'appdeckConfig'));
     } else {
         /** Create our own URL prefix for displaying app mobile content **/
         add_filter('query_vars', array($this, 'addQueryVars'));
         add_action('parse_request', array($this, 'parseRequests'));
         add_action('init', array($this, 'addRewriteRule'));
         //TODO: flush rewrite rules upon plugin install
         /** Template redirector ** not used
         			add_filter( 'template_include', array( $this, 'template_redirect' ) );
         			*/
         /** Template switcher **/
         add_filter('template_include', array($this, 'var_template_include'), 1000);
         add_filter('template_directory', array($this, 'template_directory'));
         add_filter('stylesheet_directory', array($this, 'template_directory'));
         add_filter('template_directory_uri', array($this, 'template_directory_uri'));
         /** Add Photo Browser JS in footer of paghes with Gallery **/
         add_filter('post_gallery', array($this, 'gallery_detect'));
         add_action('wp_footer', array($this, 'print_photobrowser_script'));
         add_action('appdeck_footer', array($this, 'print_photobrowser_script'));
     }
 }